aethexDocs

API Reference

Microsoft Teams Phone

Connect a Microsoft Teams tenant, attach one of your existing Teams numbers to an agent, and place outbound calls over Azure Communication Services. All endpoints live under /integrations/telephony/msteams and authenticate with the X-API-Key header.

Base URL
https://api.aethexai.com/api/v1
Endpoints
6
Scopes
msteams:readmsteams:writecalls:writephone_numbers:write
POST/integrations/telephony/msteams/connect

Begin Microsoft admin consent

Start Teams connection

Starts the Microsoft admin-consent flow. Returns a consent_url to send your Teams or Global administrator to, and state_expires_in, the number of seconds the link stays valid. No connection is recorded until the administrator approves. Aethex stores only your Microsoft tenant id, never a secret. Requires the msteams:write scope.

Errors

1
503Not enabled

Microsoft Teams Phone connect is not enabled or not configured on this deployment.

Contact [email protected] to enable Microsoft Teams for your account.

GET/integrations/telephony/msteams

Read the linked Teams connection

Get connection

Returns your tenant's active Microsoft Teams connection, including the linked Microsoft tenant (home_tenant_id) and its status. Requires the msteams:read scope.

Errors

1
404Not connected

Your tenant has no Microsoft Teams connection yet.

Run POST /integrations/telephony/msteams/connect and complete admin consent.

GET/integrations/telephony/msteams/resource-accounts

Teams numbers linked to Aethex, plus the setup command

List resource accounts

Lists the Teams resource accounts you have linked to Aethex and the number assigned to each. Also returns connect_command: the one-time Microsoft Teams PowerShell line your admin runs to create a linked resource account. The ApplicationId and AcsResourceId are pre-filled in the returned command, so run it verbatim, replacing only YOUR-TEAMS-DOMAIN. Requires the msteams:read scope.

Errors

3
404Not connected

Your tenant has no Microsoft Teams connection yet.

Run POST /integrations/telephony/msteams/connect and complete admin consent first.

409Reconnect required

The Microsoft session captured at connect has expired.

Call POST /integrations/telephony/msteams/connect again to re-approve.

502Microsoft Graph error

Microsoft returned an error while listing your resource accounts.

Retry shortly. If it persists, contact support.

POST/integrations/telephony/msteams/attach

Route a Teams number to an agent

Attach a number

Binds a linked resource account's phone number to one of your agents, so inbound calls to the number are answered by that agent. Idempotent per number: re-attaching re-points the number at the given agent. Requires the msteams:write scope.

Request body

3
  • resource_account_idstringrequired

    An id returned by GET /integrations/telephony/msteams/resource-accounts.

  • agent_idstring (uuid)required

    The agent that should answer calls to this number. Must belong to your account.

  • friendly_namestringoptional

    Optional label for the number. Defaults to the resource account's display name.

Errors

4
404Not found

The agent doesn't exist on your account, the resource account isn't linked to Aethex for your tenant, or you have no Teams connection.

Check the agent_id and resource_account_id, and confirm the connection with GET /integrations/telephony/msteams.

409Reconnect required

The Microsoft session captured at connect has expired.

Call POST /integrations/telephony/msteams/connect again to re-approve, then retry.

409Number unavailable

The resource account has no number assigned yet, or the number is already connected to another Aethex account.

Assign a number to the resource account in the Teams Admin Center, or release it from the other account first.

502Microsoft Graph error

Microsoft returned an error while authorizing the number.

Retry shortly. If it persists, contact support.

POST/integrations/telephony/msteams/calls

Dial a number from an agent

Place an outbound call

Rings to_number and bridges the callee into the agent's voice pipeline. Dials on behalf of the agent's attached Teams number when one exists, so the recipient sees your own number; an agent with no Teams number attached falls back to Aethex's managed Teams calling number (no completed connection required for the fallback). Billed like any Aethex call and subject to billing and capacity checks. Requires the msteams:write and calls:write scopes.

Request body

2
  • agent_idstring (uuid)required

    The agent whose voice pipeline runs the call. Must belong to your account.

  • to_numberstringrequired

    Destination number in E.164, e.g. +14155550123.

Errors

9
402Payment required

The account has a hard billing block, so calls are paused.

Resolve the balance or payment method in billing, then retry.

403Number suppressed

to_number is on your account's do-not-call list. The refusal happens before anything is reserved, so no ACS call connection exists.

Do not retry. Remove the number from what you dial, or release the entry through POST /suppressions/{id}/release if it is yours to lift.

404Agent not found

No agent with that agent_id exists on your account.

Pass an agent_id that belongs to your account.

409Agent not ready

The agent exists but isn't in a state that can take a call.

Check the agent is fully configured and active, then retry.

422Invalid number

to_number is not a valid E.164 phone number.

Send the destination in E.164 format, e.g. +14155550123.

429At capacity

The voice backends are momentarily saturated and couldn't reserve a slot.

Retry with backoff. Contact us if sustained.

502Calling backend error

The Azure Communication Services calling backend returned an error.

Retry shortly. If it persists, contact support.

503Not available

Microsoft Teams calling is not enabled or not configured on this deployment.

Contact [email protected] to enable Microsoft Teams for your account.

503Suppression list unreadable

The do-not-call list could not be read, so the call was refused rather than placed.

Retry after a short back-off. The same request is safe to send again.

DELETE/integrations/telephony/msteams

Remove the Teams connection

Disconnect Teams

Disconnects your tenant's Microsoft Teams connection. Idempotent: it always returns 204 No Content, whether or not a connection existed. Attached numbers stop routing to agents. Requires the msteams:write scope.