Create Line Request
Lines & Leads
Create Line Request
Create a new phone or email line request for the authenticated workspace. REST endpoint in the Tuco AI iMessage API — bearer-token auth, JSON request/response.
POST
Create Line Request
Use this endpoint after the workspace already has an active Tuco subscription. If the request is included in the current plan, Tuco starts provisioning immediately. If the request requires an add-on, Tuco returns a hosted invoice link.
What This Endpoint Decides
You send the line details once, and Tuco decides what should happen next. The response will always fall into one of these buckets:provisioningTuco accepted the request immediately and has started setting up the line.awaiting_paymentTuco saved the request, but it needs payment before provisioning can begin.subscription_requiredThe workspace needs an active base plan before it can request lines.forbidden_line_typeThe current plan does not allow that request, or the plan reached a hard cap with no paid expansion path.
Authentication
Pass your workspace API key as a Bearer token, or use a Clerk session token.Request body
Required. Display first name for the line.
Required. Display last name for the line.
Required line channel. Supported values:
"phone" or "email".Optional for phone lines. Supported values:
"purchased" or "byon". Defaults to "purchased" when omitted.Required for email lines. Also required for BYON phone lines.
Required for BYON phone lines.
Optional. Used for purchased phone provisioning when relevant.
Optional. Used for purchased phone provisioning when relevant.
Optional. Forwarding destination for phone lines.
Optional. Avatar shown in Tuco.
Optional. You can also send this as the
Idempotency-Key header. Reusing the same key returns the original response instead of creating a duplicate request.Required field rules
| Request type | Required fields |
|---|---|
| Email line | firstName, lastName, channelType=email, email |
| Purchased phone line | firstName, lastName, channelType=phone |
| BYON phone line | firstName, lastName, channelType=phone, lineType=byon, email, phone |
Default behavior for phone lines
IfchannelType is phone and lineType is omitted, Tuco treats the request as:
lineType: "byon".
Example: included line
Success: provisioning (201 Created)
Example: paid add-on line
Success: awaiting payment (201 Created)
What To Do After You Create A Request
If the response isprovisioning:
- keep the returned
line._id - poll
GET /api/line-requests/:idfor status updates
awaiting_payment:
- keep the returned
line._id - show the
paymentUrlto the user - after payment, poll
GET /api/line-requests/:iduntil it changes toprovisioning
One Request At A Time
Tuco blocks a new request only when the workspace already has a line request inawaiting_payment.
This prevents:
- duplicate unpaid requests
- accidental double purchases
- race conditions from retries
provisioning do not block the next request.
Error responses
| Status | When | Body |
|---|---|---|
400 | Missing required fields or invalid types | { "error": "..." } |
401 | Missing or invalid API key / session | { "error": "Unauthorized" } |
403 | Workspace has no active subscription | { "success": false, "status": "subscription_required", "message": "...", "redirect": "/billing" } |
403 | Line type is not allowed on the plan, or hard cap reached with no paid expansion | { "success": false, "status": "forbidden_line_type", "message": "..." } |
409 | Another line request is already waiting for payment | { "success": false, "status": "request_in_progress", "message": "...", "existingLine": { ... } } |
429 | Rate limit exceeded | { "error": "Rate limit exceeded", "retryAfterMs": 1234 } |
Notes
- Payment is always attached to the exact saved line request. The caller does not need to resubmit the payload after paying.
- The API uses the authenticated workspace. You cannot request lines for an arbitrary workspace id in the body.
- Retry safety is built in through idempotency support and workspace-level request locking.