Skip to main content

PurchaseDID purchases a DID from the pool and adds it to the subscription.

POST 

/api/v1/voice/did-pool/purchase

This is a customer-facing endpoint that:

  1. Looks up the DID pool item to verify availability
  2. Gets the organization's active subscription
  3. Adds the DID as a subscription item (triggers billing)
  4. The billing event triggers automatic DID allocation

Parameters

  • did_pool_id: Required, the DID pool item to purchase

Prerequisites

  • DID must be available in the pool
  • Organization must have an active subscription
  • DID price must be configured

Side Effects

  • Creates subscription item in billing service
  • Triggers subscription_item.did_added event
  • DID is allocated to organization (async via event)

Errors

  • NOT_FOUND: DID pool item does not exist
  • FAILED_PRECONDITION: DID not available for purchase
  • FAILED_PRECONDITION: No active subscription
  • FAILED_PRECONDITION: DID has no price configured
  • PERMISSION_DENIED: Caller lacks voice:did:write permission

Request

Responses

A successful response.