Provision dedicated WhatsApp line
Provision dedicated WhatsApp line: provisionWhatsappDedicatedLine in the TypeScript, Python, Rust and Go clients.
POST /v1/projects/{id}/platforms/whatsapp/dedicated
Provisions one dedicated WhatsApp line with WhatsApp and shared Voice enabled. It attaches to an eligible iMessage line the project already owns when possible so both products keep the same number; otherwise it claims healthy, available WhatsApp-capable dedicated-line inventory. Always answers 202, because waiting when no inventory is available is not a failure. The product opens its own charge period after the abilities are enabled; Voice has no separate charge. Waiting requests are served first come, first served, and are cancelled with a reason exactly as for a dedicated iMessage line. Cancel the returned operation to stop waiting. An optional promotionCode is checked and claimed here, before the request waits for a line: a code that can't be used answers 409 PROMOTION_CODE_REJECTED and starts nothing. The Idempotency-Key is required and permanent. If the operation fails, its error is the problem of one of these codes: CHARGE_REFUSED, ENTERPRISE_PLAN_REQUIRED.
photon.projects.platforms.provisionWhatsappDedicatedLine(input: ProvisionWhatsappDedicatedLineInput, options?: RequestOptions): Promise<ProvisionWhatsappDedicatedLineOutput>photon.projects.platforms.provision_whatsapp_dedicated_line(input: ProvisionWhatsappDedicatedLineInput, *, options: RequestOptions | None = None) -> models.Operationclient.provision_whatsapp_dedicated_line(idempotency_key: String, id: String, body: &types::ProvisionWhatsappDedicatedLineRequest).await -> Result<ResponseValue<types::Operation>, Error<ProvisionWhatsappDedicatedLineError>>client.Projects.Platforms.ProvisionWhatsappDedicatedLine(ctx context.Context, params *ProvisionWhatsappDedicatedLineParams, opts ...RequestOption) (*Operation, error)import { Photon } from "@photon-ai/api";
const photon = new Photon({
headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.platforms.provisionWhatsappDedicatedLine({
path: {
id: "id",
},
headers: {
idempotencyKey: "idempotencyKey",
},
body: {},
});import os
from photon_api import Photon
from photon_api.rpc_generated import ProvisionWhatsappDedicatedLineInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.platforms.provision_whatsapp_dedicated_line(
ProvisionWhatsappDedicatedLineInput.model_validate({
"path": {
"id": "id",
},
"headers": {
"Idempotency-Key": "idempotencyKey",
},
"body": {},
})
)use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};
let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
.credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
.build()?;
let result = client
.provision_whatsapp_dedicated_line(
"idempotencyKey".to_owned(),
"id".to_owned(),
&serde_json::from_value(serde_json::json!({}))?,
)
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
"encoding/json"
"os"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
var body photonapi.ProvisionWhatsappDedicatedLineRequest
if err := json.Unmarshal([]byte(`{}`), &body); err != nil {
return err
}
result, err := client.Projects.Platforms.ProvisionWhatsappDedicatedLine(ctx, &photonapi.ProvisionWhatsappDedicatedLineParams{
IdempotencyKey: "idempotencyKey",
ID: "id",
Body: body,
})
if err != nil {
return err
}
_ = result{
"cancellable": true,
"createdAt": "2026-01-01T00:00:00.000Z",
"detail": {},
"endedAt": "2026-01-01T00:00:00.000Z",
"error": {
"code": "CHARGE_REFUSED",
"remediation": {
"action": "Check the payment method in Billing, then request the purchase again."
},
"status": 402,
"title": "Charge Refused",
"type": "https://photon.codes/docs/problems/charge-refused"
},
"operationId": "string",
"projectId": "string",
"reason": "charge_refused",
"resourceId": "string",
"resourceType": "string",
"startedAt": "2026-01-01T00:00:00.000Z",
"state": "pending",
"type": "resource.provision",
"updatedAt": "2026-01-01T00:00:00.000Z"
}Parameters
Selects the API contract date. Without it, the request is served as 2026-07-01.
Identifies one logical mutation across retries.
Body
A promotion code to apply to this line's charge. Billing takes a fixed amount off the charge. The code is checked and claimed when the request is accepted, even if the line has to wait for inventory: a code that can't be used answers 409 PROMOTION_CODE_REJECTED and starts nothing, and one accepted still applies if it later expires. A purchase that ends without a line gives the code back. Part of the request's identity: repeating the Idempotency-Key with a different code, or none, is refused.
Returns
202 The attachment was accepted and is running. GET the Location after the Retry-After interval until state is terminal. Operation
Headers: Location, Photon-Version. The raw response carries these headers; see Raw responses.
Why the operation failed: the problem of its code, the same object the endpoint returns when it rejects a request, with the status that rejection would have had (the poll itself answers 200). Every code an operation can end with is a branch below, and the endpoint that starts the operation lists its codes. Branch on code, never on status, and keep a default: a code added after your client was generated arrives as a generic problem with type: about:blank and status: 500. That 500 means this document does not describe the code yet, not that the request failed on our side or that retrying will help.