Skip to main content
POST
Assign a line
  • Credential: an API key with no list of lines. See Assignment.
  • Account: wholesale partners only: any other account receives 402 checkout_required.
  • Line-scoped keys: every line-scoped key gets 403 forbidden.
  • Test keys: an assignment sent with an isnap_test_ account key takes a real line, billed like any other: see Test keys.
  • Idempotency-Key: honored, and remembered for 24 hours. Without it, every retry takes one more billable line. See Retries and Lines and hosted macOS sessions.
  • Events: none. See Events.

Errors

With as_test_line: true, the call can also return an error of convert-to-test after the line was assigned. The line then stays yours as a rented line: see Assignment. The errors that every operation shares are in Errors.

Authorizations

Authorization
string
header
required

An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.

Headers

idempotency-key
string

Optional key that makes a retry safe. A request repeated with the same key, by the same API key, with the same method, path and body, within 24 hours, returns the first successful response unchanged, its trace_id and request_id included, and does not act again. The body is compared byte for byte: a request with no body and a request with {} are two different requests. The same key with another method, path or body returns 409 idempotency_key_collision. While the first request is still running, a retry returns 503 idempotency_in_flight; a request that never completes frees its key after 60 seconds. Only a 2xx response is recorded: after a failed request, the retry runs again. At most 255 characters: a longer key returns 400 validation_failed. The X-Idempotency-Key header is read when Idempotency-Key is absent.

Maximum string length: 255

Body

application/json

The line to take: its kind and, optionally, its area code, its variant and its metadata.

billing_tier
enum<string>
required

The kind of line to take.

Available options:
rental_iphone,
rental_android,
byod_imessage,
byod_android
area_code
string

Take a line whose area_code is exactly this value. Omit it to take a line of any area code.

Required string length: 1 - 10
inbound_only
boolean

true to take the line as an inbound-only line. Rented tiers only (400 inbound_only_not_rental otherwise). Defaults to false: a two-way line.

as_test_line
boolean

true to make the line a test line for the trials of your own prospects, in the same call. Rented tiers only (400 test_line_not_rental otherwise), and not together with inbound_only (400 test_line_not_inbound_only). Defaults to false.

metadata
object

Your own key-value data, set on the line in place of any metadata it carried. Omit it to clear the metadata of the line. At most 20 keys and 8,192 bytes once serialized as JSON. The keys migration_ref and proof_line are reserved (400 reserved_metadata_key). Never put personal data or secrets in it.

Example:

Response

The assigned line, active, with its full phone number.

success
enum<boolean>
required

Always true on a success response.

Available options:
true
data
object
required

A line. billing_tier, byod, shared, test_line and inbound_only tell the kinds of line apart: a rented line (two-way or inbound-only), a BYOD line, a shared line, a test line.

trace_id
string
required

Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.

request_id
string
required

Id of the request that produced this response: req_ followed by 25 letters or digits.