Cumulus TalosDocs
Open Talos
On this page

numbers.import

Import a phone number from a connected trunk

Request

POST /api/v1/telephony/numbers

  • MCP: numbers_import
  • SDK: client.numbers.import (SDK path arguments use path; MCP uses params).
  • Minimum API key role: admin.
  • Idempotency: required_header. Send an Idempotency-Key header; MCP uses idempotency_key. Reuse it after an unknown outcome.

Needs an admin key and a trunk from trunks_create; e164 is a number on that Twilio trunk. state ready means it can be a caller ID (runs_create from, agent.telephony from). If the call answers that provisioning is pending, repeat it with the same body. inbound_agent_id requires an inbound-enabled trunk and a published phone agent.

Input schema

json
{
  "parameters": [
    {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/NumbersImportRequest"
        }
      }
    }
  }
}

Responses

json
{
  "201": {
    "description": "Import a phone number from a connected trunk",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ByocNumber"
        }
      }
    }
  },
  "4XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  },
  "5XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

Referenced schemas

json
{
  "components": {
    "schemas": {
      "NumbersImportRequest": {
        "type": "object",
        "properties": {
          "e164": {
            "type": "string",
            "pattern": "^\\+[1-9][0-9]{6,14}$"
          },
          "trunk_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-z0-9][a-z0-9_-]*$"
          },
          "nickname": {
            "type": "string",
            "maxLength": 256
          },
          "inbound_agent_id": {
            "allOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            ],
            "nullable": true
          },
          "outbound_agent_id": {
            "allOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "e164",
          "trunk_id"
        ],
        "additionalProperties": false
      },
      "ByocNumber": {
        "type": "object",
        "properties": {
          "number_id": {
            "type": "string",
            "format": "uuid"
          },
          "e164": {
            "type": "string",
            "pattern": "^\\+[1-9][0-9]{6,14}$"
          },
          "trunk_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-z0-9][a-z0-9_-]*$"
          },
          "nickname": {
            "type": "string",
            "maxLength": 256,
            "nullable": true
          },
          "inbound_agent_id": {
            "allOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            ],
            "nullable": true
          },
          "outbound_agent_id": {
            "allOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            ],
            "nullable": true
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "ready"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "number_id",
          "e164",
          "trunk_id",
          "nickname",
          "inbound_agent_id",
          "outbound_agent_id",
          "state",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "invalid_request",
                  "idempotency_conflict",
                  "policy_denied",
                  "capability_unavailable",
                  "provider_unavailable",
                  "knowledge_unavailable",
                  "publication_invalid",
                  "run_not_active",
                  "rate_limited",
                  "outcome_unknown",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "none",
                  "unknown"
                ]
              },
              "details": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "outcome"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}

Errors and recovery

See API error handling and Troubleshooting.

Content version a43347b3Markdown source
numbers.import · Cumulus Talos docs