Skip to content

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>
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: {},
});
{
  "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

Photon-VersionPhotonVersion

Selects the API contract date. Without it, the request is served as 2026-07-01.

Idempotency-Keystringrequired

Identifies one logical mutation across retries.

idstringrequired

Body

promotionCodestring

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.

cancellablebooleanrequired
createdAtstring (date-time)required
detailobject
endedAtstring (date-time)
errorOperationError

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.

operationIdstringrequired
projectIdstringrequired
reasonOperationReason
resourceIdstring
resourceTypestringrequired
startedAtstring (date-time)
stateOperationStaterequired
typeOperationTyperequired
updatedAtstring (date-time)required