Skip to main content

Reserve a Number

Reserve a phone number before purchasing it. Reservations expire after a set period, so make sure to complete the purchase before the reservation expires.

Endpoint

POST https://api.p.2chat.io/open/numbers/reservations

Authentication

Include your API key in the X-User-API-Key header. Learn more about authentication.

Parameters

These parameters should be sent as JSON payload in the request body.

FieldTypeRequiredDescription
group_idstringYesThe group ID from the Search Number Groups endpoint
numberstringNoA specific number to reserve (from the Available Numbers endpoint)
tip

If you don't specify a number, a random available number from the group will be reserved for you.

Invocation

curl --location --request POST 'https://api.p.2chat.io/open/numbers/reservations' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"group_id": "abc-123",
"number": "+12135551234"
}'

Response

Success (HTTP 201 Created)

{
"success": true,
"data": {
"reservation_details": {
"uuid": "reservation-uuid-here",
"number": "+12135551234",
"created_at": "2024-01-15T10:30:00Z",
"expires_at": "2024-01-15T11:30:00Z"
}
}
}
FieldDescription
reservation_details.uuidReservation UUID — use this to cancel the reservation if needed
reservation_details.numberThe reserved phone number
reservation_details.created_atWhen the reservation was created
reservation_details.expires_atWhen the reservation will expire
caution

Reservations expire automatically. Make sure to purchase your reserved numbers before the expiration time.

Error

{
"success": false,
"error": true,
"error_message": "Description of what went wrong"
}