Attach a campaign to a phone number
Associate a 10DLC campaign with a phone number you own. Carrier-side propagation happens after the campaign is approved on the carrier side; this call records the association immediately.
Validation is checked in order, and the first failure is returned:
campaign_idmissing or not a valid id returns422 VALIDATION_FAILED.- Campaign not found in your organization returns
404 NOT_FOUND. - Campaign that is
PENDINGorEXPIREDreturns409 CAMPAIGN_NOT_ACTIVE. - Campaign whose linked brand is not
VERIFIEDorVETTED_VERIFIEDreturns409 BRAND_NOT_VERIFIED. - Number not owned by your organization returns
404 NOT_FOUND. - Number that is not currently assigned returns
409 NUMBER_NOT_ASSIGNED.
This call is idempotent: re-attaching the campaign already on the number
returns 200 OK with no change. To move a number to a different campaign,
attach the new one in a single call; it replaces the current campaign
atomically.
Requires the numbers:write scope.
Authenticate by sending your API key as a bearer token:
Authorization: Bearer am_live_.... Every request is automatically
scoped to the organization that owns the key and to the scopes granted
to that key.
In: header
Path Parameters
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/phone-numbers/497f6eca-6276-4993-bfeb-53cbbbba6f08/campaign" \ -H "Content-Type: application/json" \ -d '{ "campaign_id": "b5d3c4e2-7f7e-44a1-8c12-2bcd9e3f0a01" }'{
"success": true,
"error": {
"code": "string",
"message": "string",
"request_id": "string",
"details": {
"property1": "string",
"property2": "string"
}
},
"meta": {
"total": 0,
"limit": 0,
"offset": 0,
"next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wNC0yNlQxMjowMDowMFoiLCJpZCI6IjAxOTAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMSJ9",
"last_event_at": "2019-08-24T14:15:22Z"
},
"data": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"number": "string",
"number_type": "local",
"inbound_url": "http://example.com",
"status_url": "http://example.com",
"label": "string",
"campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904",
"carrier_line_option_status": "pending",
"carrier_line_option_propagated_at": "2019-08-24T14:15:22Z",
"sms_enabled": true,
"mms_enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "authentication failed",
"request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
}
}{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "missing required scope",
"request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "not found",
"request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
}
}{
"success": false,
"error": {
"code": "CAMPAIGN_NOT_ACTIVE",
"message": "campaign is not active",
"request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
}
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "validation failed",
"request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM",
"details": {
"to": "must be E.164",
"body": "must be 1..1600 chars"
}
}
}