Skip to main content

Create a Pin Allocation

Generate a PIN and map it to users via a virtual number for secure communication.

When you create an allocation, the system assigns a PIN to a virtual number from your pool and associates it with one or more A-party (agent/seller) numbers. The B-party (customer) can then call the virtual number, enter the PIN, and get connected to the A-party — without either side seeing the other's real number.

HTTP Request​

POST https://leadassist.exotel.in/v1/tenants/<tenant_id>/greenpin

Headers​

HeaderValue
Content-Typeapplication/json
AuthorizationHTTP Basic Auth — Account SID as username, ExoBridge token as password

Authentication​

Pass credentials using HTTP Basic Auth. Your Account SID is the username and your ExoBridge token is the password. In cURL, use the user:password@host format or the -u flag.

Request Body Parameters​

ParameterTypeRequiredDescription
caller_id_numberStringYesVirtual number for the allocation, in E.164 format. Must be from your provisioned VN pool.
fromArray of StringsYesA-party phone number(s) — the agent or seller side. E.164 format. At least one number required.
toArray of StringsNoB-party phone number(s) — the customer side. E.164 format. Can be left empty and set later via the Update endpoint.
durationIntegerNoAllocation validity in seconds. Default: 86400 (24 hours). Min: 300 (5 minutes). Max: 14688000 (170 days).
max_pin_attemptsIntegerNoMaximum number of incorrect PIN attempts before the allocation is locked out. Default: 3.
recordBooleanNoSet to true to record all calls on this allocation. Default: false.
custom_fieldStringNoArbitrary metadata string you want associated with this allocation (max 256 characters). Returned as-is in event callbacks.

Example Request​

curl -X POST \
'https://leadassist.exotel.in/v1/tenants/<tenant_id>/greenpin' \
-u '<account_sid>:<exobridge_token>' \
-H 'Content-Type: application/json' \
-d '{
"caller_id_number": "+914000XXXXXX",
"from": ["+919900XXXXXX"],
"to": ["+918800XXXXXX"],
"duration": 3600,
"max_pin_attempts": 3,
"record": false,
"custom_field": "order_id=12345"
}'

Example Response​

{
"response": {
"greenpin_id": "gp_abc123xyz",
"virtual_number": "+914000XXXXXX",
"pin": "4821",
"from": ["+919900XXXXXX"],
"to": ["+918800XXXXXX"],
"status": "active",
"created_at": "2024-06-15T10:30:00+05:30",
"expires_at": "2024-06-15T11:30:00+05:30",
"custom_field": "order_id=12345"
}
}

Response Fields​

FieldTypeDescription
greenpin_idStringUnique identifier for this allocation. Use this ID in subsequent Get, Update, and Delete requests.
virtual_numberStringThe virtual number assigned to this allocation. B-party dials this number to reach A-party.
pinStringSystem-generated PIN. B-party enters this after calling the virtual number.
fromArray of StringsA-party number(s) associated with this allocation.
toArray of StringsB-party number(s) associated with this allocation. Empty array if not set at creation.
statusStringCurrent state of the allocation. See Status Values below.
created_atStringISO 8601 timestamp when the allocation was created.
expires_atStringISO 8601 timestamp when the allocation will expire, based on the duration set.
custom_fieldStringThe custom metadata string passed at creation, if any.

Status Values​

StatusDescription
activeAllocation is live. Calls can be connected.
expiredAllocation has passed its expires_at time. No new calls can be connected.
deletedAllocation was explicitly deleted via the Delete endpoint.

HTTP Status Codes​

Status CodeMeaning
201 CreatedAllocation created successfully. Response body contains the full allocation object.
400 Bad RequestMissing or invalid parameters. Check that caller_id_number and from are present and in E.164 format.
401 UnauthorizedAuthentication failed. Verify your Account SID and ExoBridge token.
403 ForbiddenThe tenant does not have access to the GreenPin feature, or the virtual number is not in your pool.
409 ConflictThe virtual number is already allocated to another active allocation.
422 Unprocessable EntityParameters are structurally valid but fail business rules (e.g., duration out of range).
500 Internal Server ErrorUnexpected server error. Retry with exponential backoff.

Notes​

  • The default maximum allocation duration is 170 days at the service level
  • Account-level configurations allow customization from as low as 5 minutes up to 170 days
  • If to is not provided at creation, the allocation is still valid — the B-party number can be added later using the Update endpoint
  • PINs are 4-digit numeric codes generated by the system; you cannot specify a custom PIN