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:
- Looks up the DID pool item to verify availability
- Gets the organization's active subscription
- Adds the DID as a subscription item (triggers billing)
- 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
- 200
- default
A successful response.
An unexpected error response.