Provision dedicated iMessage line
Provision dedicated iMessage line: provisionImessageDedicatedLine in the TypeScript, Python, Rust and Go clients.
POST /v1/projects/{id}/platforms/imessage/dedicated
Claims one dedicated iMessage line for the project and enables iMessage on it. Always answers 202 with an operation: dedicated lines are allocated from available capacity, and unavailable capacity causes a wait rather than a failure — this can legitimately stay running for hours, which is exactly why the response is a handle to poll rather than a number. The project's messaging subscription must grant the dedicated iMessage lines entitlement (imessage_dedicated_lines.can_purchase), and that is checked before capacity is reserved. The line's own charge starts when a line is claimed; the subscription that grants the entitlement bills on its own terms, which cancelling a request does not change. Waiting requests are served first come, first served. One that is still waiting is cancelled with a reason if the project is deleted (project_deleted) or its plan stops selling dedicated lines (entitlement_lost); while the payer is restricted for overdue payment it keeps waiting. If you no longer want to wait, POST to the operation's cancel endpoint, which charges nothing for the line. The Idempotency-Key is required and permanent: repeating it returns the same operation forever. A further line always needs a NEW key, including while others are still 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. Requires the platforms:write permission bound to the project resource in the path. If the operation fails, its error is the problem of one of these codes: CHARGE_REFUSED, ENTERPRISE_PLAN_REQUIRED.
photon.projects.platforms.provisionImessageDedicatedLine(input: ProvisionImessageDedicatedLineInput, options?: RequestOptions): Promise<ProvisionImessageDedicatedLineOutput>photon.projects.platforms.provision_imessage_dedicated_line(input: ProvisionImessageDedicatedLineInput, *, options: RequestOptions | None = None) -> models.Operationclient.provision_imessage_dedicated_line(idempotency_key: String, id: String, body: &types::ProvisionImessageDedicatedLineRequest).await -> Result<ResponseValue<types::Operation>, Error<ProvisionImessageDedicatedLineError>>client.Projects.Platforms.ProvisionImessageDedicatedLine(ctx context.Context, params *ProvisionImessageDedicatedLineParams, 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.provisionImessageDedicatedLine({
path: {
id: "id",
},
headers: {
idempotencyKey: "idempotencyKey",
},
body: {},
});import os
from photon_api import Photon
from photon_api.rpc_generated import ProvisionImessageDedicatedLineInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.platforms.provision_imessage_dedicated_line(
ProvisionImessageDedicatedLineInput.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_imessage_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.ProvisionImessageDedicatedLineRequest
if err := json.Unmarshal([]byte(`{}`), &body); err != nil {
return err
}
result, err := client.Projects.Platforms.ProvisionImessageDedicatedLine(ctx, &photonapi.ProvisionImessageDedicatedLineParams{
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 provision was accepted and is running. GET the Location after the Retry-After interval until state is terminal; the response there carries the line once one is claimed. 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.