Messaging Services API
Messaging Services endpoints exposed by the Devotel CPaaS API Base path:/api/v1/messaging
Endpoint count: 14
title: “Errors worth branching on” description: “Per-endpoint failure templates matching the envelope — what actually fires, what to retry, what to surface to the operator.”
Worked request and response samples
A messaging service is the container/v1/messages resolves once at send time — sender pool, opt-out list, inbound webhook, sending flags and throughput cap under one id you pass as messaging_service_id. Only label is required at create; every other field is nullable. The four-step loop below is the whole journey: make the container, bind two senders, verify the residency pin, then check the per-service throughput gate before arming an outbound campaign. Channel-fallback equivalents of this exact loop are in SMS services and the Messaging Services console guide.
1. Create the container
POST /api/v1/messaging/servicesnull on a later PATCH clears them. external_id is only for migrator import (Twilio MGxxx) and must be unique — a duplicate returns 409 (see the 409 block below).
2. Bind two senders
POST /api/v1/messaging/services/{id}/phone-numbersDELETE /api/v1/messaging/services/{id}/phone-numbers/{numberId} (204, no body).
3. Verify the residency pin
Before arming a campaign for a regulated buyer, confirm where the message plane rests and is processed.GET /api/v1/messaging/data-residencystoredAndProcessedInRegion: true is the whole answer — both the at-rest and the processing axes of the plane honour the pin. When it reports false, route the campaign through BYOC or hold it. This is a tenant-owned control; it wires no carrier and changes nothing about how traffic terminates.
4. Check the throughput gate, then send
Before arming a campaign, read the per-service gate live and re-arm only when the queue is clear.GET /api/v1/messaging/services/{id}/throughput-statsmps_cap is null when the service is uncapped; queue_depth counts over-cap sends 429’d this second. Raise or clear the cap with PATCH /api/v1/messaging/services/{id}/throughput ({ "mps_cap": 80 } or null). The frequency caps guide covers recipient-level pacing; message suppression handles opt-outs — both compose into the same gate.
These five failures cover the messaging-service create (POST /api/v1/messaging-services), which campaign provisioning flows through. Each block below is a full { error, meta } envelope as the API returns it, and the matrix at the bottom answers retry vs surface for the same five classes. For the platform-wide decision table these branches plug into, see the error handling guide.
401 — Unauthorized
401 on this page is the bearer key failing before the route ran — it never means the resource is wrong. Rotate the key or re-mint the scoped token; retrying the same request changes nothing.
403 — Forbidden
403 means the key authenticated but the operation is gated by scope — check the key’s scopes on the developer page; a 403 is never a data-not-found shape.
422 — Schema
422 means the payload did not match the request schema — branch on error.details.field and resend with an allowed service name (1-48 chars) instead of blind-retrying the same body.
429 — Rate
Retry-After header and error.details.retry_after are both set on every 429 — resend the SAME request after the lower of the two.
409 — Conflict
60-second retry matrix
Get messaging data residency
GET /api/v1/messaging/data-residencyPUT /v1/compliance/data-residency.
List messaging services
GET /api/v1/messaging/services/v1/messages. Use it to populate a service picker or reconcile your configuration. Returns up to 500 services; an empty array means none are configured yet.
Get messaging service
GET /api/v1/messaging/services/{id}List messaging service phone numbers
GET /api/v1/messaging/services/{id}/phone-numbersGet messaging service throughput cap
GET /api/v1/messaging/services/{id}/throughputmps_cap is null when the service is uncapped (inherits only the tenant/provider limits). Use it to hydrate the throughput slider before an operator raises or clears the cap. Returns 404 when the id is not a messaging service in this tenant.
Get messaging service throughput stats
GET /api/v1/messaging/services/{id}/throughput-statsLook up messaging service by external id
GET /api/v1/messaging/services/lookupMGxxx) or any opaque vendor id you stored on the service — and return the matching Orbit resource with its full configuration. Pass the id as the external_id query parameter. Used by the Twilio migrator import flow and the dashboard’s “I came from Twilio” wizard to map a foreign id onto the Orbit resource. Returns 404 when no service in this tenant carries that external id, so the caller can branch into a create-new flow without parsing a 200 body.
Get account messaging throughput stats
GET /api/v1/messaging/services/throughput-statsservices array when no messaging services are configured yet.
Create messaging service
POST /api/v1/messaging/services/v1/messages resolves once at send time to copy sender pool, opt-out list, inbound webhook, sending flags and throughput cap onto the message. Only label is required; attach a sender_pool_id (or per-country country_sender_pools), an opt_out_list_id, inbound/fallback/status-callback URLs, an mps_cap, and an external_id (Twilio MGxxx) so the migrator can reconcile an imported service. Use it when standing up a new sending profile. Owner / admin only; a duplicate external_id returns 409.
Attach phone number to messaging service
POST /api/v1/messaging/services/{id}/phone-numbers{ phone_number_id }. Owner / admin only; returns 404 when the service or number is not found in this tenant.
Update messaging service
PATCH /api/v1/messaging/services/{id}sender_pool_id, opt_out_list_id, the webhook URLs, validity_period_seconds, mps_cap, external_id) accept null to clear them; pass country_sender_pools: {} to remove all per-country overrides. Changes bust the per-service send cache so the next send reads them within seconds. Owner / admin only; returns 404 when the id is not a messaging service in this tenant.
Update messaging service throughput cap
PATCH /api/v1/messaging/services/{id}/throughputmps_cap to throttle sends that reference this service through the shared token-bucket limiter; send null to remove the cap and inherit only the tenant/provider limits. Use it to protect downstream carriers or a bursty campaign from starving the tenant pool. Owner / admin only; returns 404 when the id is not a messaging service in this tenant.
Delete messaging service
DELETE /api/v1/messaging/services/{id}/v1/messages calls referencing the id fail to resolve immediately; messages already sent are unaffected. Use it to retire a sending profile you no longer need. Owner / admin only; returns 404 when the id is not a messaging service in this tenant and 204 No Content on success.
204 No Content
Detach phone number from messaging service
DELETE /api/v1/messaging/services/{id}/phone-numbers/{numberId}204 No Content