Skip to content

API reference

Plain REST and JSON. No SDK.

  • Base URL: https://silverarrows.dev/v1. Locally (demo mode) it's http://localhost:3000/v1. (/api/v1/... is the same API under its internal path; both work.)
  • Auth: Authorization: Bearer arrow_live_…. Create keys in the dashboard under Account → API keys. In demo mode the seeded key arrow_live_demoKeyForLocalUseOnly0000000000 works.
  • Bodies: JSON (Content-Type: application/json). Timestamps are ISO-8601 UTC.
export SA="https://silverarrows.dev/v1"
export KEY="arrow_live_…"

Errors

Every error uses the same shape. message is written for people and code is for programs:

{ "error": { "code": "keyword_taken", "message": "The keyword TAROT is already taken. Pick another one." } }

Validation errors also include details:

{
  "error": {
    "code": "invalid_request",
    "message": "keyword: must be 2–20 letters or digits (A–Z, 0–9), no spaces",
    "details": [{ "path": "keyword", "message": "must be 2–20 letters or digits (A–Z, 0–9), no spaces" }]
  }
}
Status code When
400 mode_removed, field_removed mode: "hosted" or "tools", or a tools / knowledge_text field. Those were removed: Silver Arrows doesn't run agents on its own model. Use webhook, relay, anthropic or openai.
400 invalid_request, invalid_json, keyword_reserved The body or query is wrong. Reserved keywords are STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, START, UNSTOP, HELP, INFO, PAUSE, YES, NO, REVOKE and OPTOUT. Keywords of 3 characters or fewer and generic words people text by accident (HI, HELLO, TEST, PIZZA, …) are reserved too and need an admin.
401 unauthorized The key is missing, malformed, unknown or revoked.
403 forbidden The caller isn't allowed, for example an API key calling /api_keys or a non-admin calling /admin.
403 trial_limit The account already has 2 free lines. Upgrade one or delete one first.
403 platform_not_approved, platform_key_required, retail_key_required, platform_suspended Platform keys and the platform API: see Platforms.
403 line_key_scope A line key (made by agent setup) called an endpoint other than its line's /reply, /send, /request_schedule_consent, /schedule_consents, /login_codes or /logins.
403 a send refusal (below) /reply, /send or /request_schedule_consent was refused.
404 not_found The line or conversation doesn't exist or isn't yours. Other accounts' lines always return 404.
409 keyword_taken, line_paused, conflict The keyword is taken (keywords stay reserved forever, including on deleted and moved lines), or the line can't be resumed.
409 idempotency_in_progress The same request is still being sent. Retry after Retry-After seconds to get its result.
422 idempotency_conflict The Idempotency-Key was already used with a different body.
429 rate_limited Too many requests (see Limits). The Retry-After header says how many seconds to wait.
502 provider_error The carrier didn't accept the text.
503 pool_empty, no_shared_number No numbers are available right now.

Limits

To keep the shared number and your endpoints from being abused, these are limited per account and per API key. Each limit refills evenly over its window (20 an hour means a burst of 20, then one more every 3 minutes):

What Limit
POST /lines/:id/test (and the wizard's connection test) 20 an hour
The wizard's endpoint check 30 an hour
POST /lines 10 a day
POST /lines/:id/login_codes 300 an hour
Free lines (shared number, internal plan value "trial") 2 per account at a time

Past a limit you get 429 with a Retry-After header (seconds) and {"error": {"code": "rate_limited", "message": "…"}}.

Send refusals (status 403, error.code):

code Meaning
no_consent The texter hasn't replied YES to scheduled texts from this line.
daily_limit They already got their one scheduled text today (UTC calendar day).
paused They texted PAUSE, or 30 days passed without an inbound.
opted_out They texted STOP. Nothing can be sent until they text START.
outside_reply_window The reply is more than 60 s after their last text, or more than 5 min after in_reply_to.
rate_limited More than 30 replies to this texter in the last hour.
over_limit The line hit its monthly limit or cap.
line_inactive The line is paused or deleted.
blocked_content The content policy blocked the message.
schedule_disabled The owner turned scheduled texts off for this line.

Lines

The line object

{
  "id": "line_8f2kQ…",
  "name": "Echo",
  "keyword": "ECHO",
  "mode": "relay",
  "plan": "trial",
  "status": "active",
  "paused_reason": null,
  "payment_issue": false,
  "payment_issue_at": null,
  "number_e164": "+14155550100",
  "text_snippet": "Text ECHO to +14155550100",
  "sms_link": "sms:+14155550100?body=ECHO",
  "redirect_until": null,
  "verified_at": "2026-10-05T12:01:00.000Z",
  "created_at": "2026-10-05T12:00:00.000Z",
  "instructions": null,
  "share_phone": false,
  "interim_enabled": true,
  "schedule_enabled": true,
  "max_reply_chars": 320,
  "daily_cap": 1000,
  "monthly_cap_usd": null,
  "fallback_text": null,
  "welcome_text": null,
  "paused_text": null,
  "messages": {
    "opt_in": { "mode": "default" },
    "welcome": { "mode": "default" },
    "help": { "mode": "text", "text": "Echo: an AI assistant by Silver Arrows LLC. Questions: help@example.com. Reply STOP to opt out. {link}" },
    "stop": { "mode": "default" },
    "paused": { "mode": "default" },
    "unknown": { "mode": "default" },
    "fallback": { "mode": "default" }
  },
  "keyword_released_at": null,
  "short_link": "https://silverarrows.dev/ECHO",
  "public_description": "Echoes whatever you text it.",
  "owner_url": null,
  "connector": {
    "webhook_url": "https://my-agent.example.com/sms",
    "webhook_secret": "whsec_••••a1b2"
  },
  "usage": { "month": "2026-10", "replies": 12, "included": 25, "credits": null }
}
  • short_link is the line's program page on our site (https://silverarrows.dev/<KEYWORD>, or /p/<id> for a platform line without a keyword). Its opt-in confirmation and HELP reply link here; share it wherever you share the number.
  • public_description (≤ 280 characters, checked by our content filter when saved) and owner_url (https only, shown as "Made by …") are optional and appear on that page. Set them on create or with PATCH; null clears them.
  • connector never contains a real secret. The webhook secret and API keys are masked to their last four characters (sk-ant-••••1234).
  • verified_at is null until POST /lines/:id/test passes. It's reset when you point the line at a different agent (mode, webhook_url, api_key, prompt_id or assistant_id).
  • messages is what texters see from us on this line (see Texter messages). instructions is an Anthropic line's system prompt.
  • usage.credits is the line's prepaid credit balance; null on lines that don't use credits.
  • usage.included is null when a line's replies are unlimited.
  • payment_issue is true while a renewal payment has failed and is being retried. The line keeps answering; update the card in the billing portal. If every retry fails the line pauses (paused_reason: "payment_failed").
  • keyword_released_at is set when a free line never passed its connection test within 7 days and gave its keyword back. keyword then holds a placeholder; PATCH a new keyword and run the test again to go live.
  • redirect_until: after a free line upgrades, the shared number answers its old keyword with "[Bot] moved! Text it at +1… from now on." until this time.

POST /lines

Creates a line. Pick its number with plan:

plan
"trial" (default) Free, on the shared number. Texters start a conversation by texting the keyword. Up to 2 per account. Returns 201 and the line object.
"line" Your own number on the Arrow plan: $20/mo per number · registered to you · 200 replies a month, then credits (50 for $5). Needs your details first: send them as registration (contact_first_name, contact_last_name, contact_email, mobile, street, city, region, postal_code, use_case; no EIN) unless you already gave them in the dashboard, else 400 registration_required lists the missing fields. Returns 201 and {"line": {…}, "checkout_url": "https://checkout.stripe.com/…"}. The line is pending payment: until the checkout completes it answers on the shared number with its keyword, like a free line. When it completes, the line moves to plan: "line" on its own number. If the checkout is never completed, the line stays a free line and you can get it a number later from the dashboard. Doesn't count toward the 2 free lines.

A free line can move to its own number later from the dashboard. Its threads come with it.

Common fields:

field type
name string, 1–60 required
keyword string, 2–20 letters or digits required. Stored uppercase, unique, and never released. Keywords of 3 characters or fewer and generic words (HI, TEST, PIZZA, …) are reserved and need an admin.
mode webhook | relay | anthropic | openai Defaults to webhook when you send a webhook_url; otherwise required.
share_phone bool Send the raw phone number to your agent. Default false: agents get a hashed sender_id.
interim_enabled bool Send a separate SMS such as “SF311 reacted with 👀” when the agent takes longer than 3 seconds or answers asynchronously. Defaults to on. An admin can turn acknowledgments off for all lines.
schedule_enabled bool Allow consent-gated scheduled sends. Default true.
max_reply_chars 160–1600 Default 320. Longer replies are split into several texts.
daily_cap int Default 1000 replies a day.
monthly_cap_usd number | null Hard monthly cap.
fallback_text string ≤ 320 | null Sent when your agent fails. Shorthand for messages.fallback.
welcome_text string ≤ 320 | null Sent after the opt-in confirmation when someone texts the keyword. The keyword itself never reaches your agent. Not billed. Shorthand for messages.welcome.
paused_text string ≤ 320 | null Sent to texters while you've paused the line. Default: silence. Shorthand for messages.paused.
messages object Your own opt-in confirmation, HELP reply, STOP confirmation and more. See Texter messages.

Fields for each mode:

mode fields
webhook webhook_url (required), webhook_secret (optional; we generate one). Reply with plain text or JSON; see Webhook. The simplest mode.
relay webhook_url (required), webhook_secret (optional, ≥ 16 chars; we generate one if you omit it), async (optional; detected automatically for n8n, Make and Tasklet URLs). The strict {"reply"} contract, with one retry; see Relay.
anthropic api_key (required), system_prompt (required), model. Claude on your key, no tools.
openai api_key (required), prompt_id (required, pmpt_…, an OpenAI dashboard Prompt run with the Responses API). assistant_id (asst_…) is still accepted for lines from before OpenAI shut down the Assistants API on 2026-08-26. See BYOK.

Webhook example (a URL is all you need):

curl -s -X POST "$SA/lines" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name":"Echo","keyword":"echo","webhook_url":"https://my-agent.example.com/sms"}'

Returns 201 and the line object. If we generated the webhook secret, the response also includes it once:

{ "id": "line_…", "keyword": "ECHO", "mode": "webhook", "status": "active", "number_e164": "+14155550100",
  "webhook_secret": "whsec_3Jx…", "…": "…" }

Store it if you want to check our signature. Later responses only show whsec_••••…. Every request we send you carries X-Arrow-Signature: sha256=<hex HMAC of the raw body>; relay endpoints must verify it, webhook endpoints may.

Your own number from the start ("plan": "line"):

curl -s -X POST "$SA/lines" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name":"Echo","keyword":"echo","mode":"relay","webhook_url":"https://my-agent.example.com/sms","plan":"line"}'
{ "line": { "id": "line_…", "keyword": "ECHO", "plan": "trial", "…": "…" },
  "checkout_url": "https://checkout.stripe.com/c/pay/cs_…",
  "webhook_secret": "whsec_3Jx…" }

Open checkout_url in a browser to pay. webhook_secret appears once, as above. If no dedicated numbers are free right now you get 503 pool_empty and no line is created. If the line was created but checkout couldn't start, checkout_url is null and checkout_error says why; the line is a free line you can get a number for later.

Relay (strict contract), Anthropic and OpenAI examples:

curl -s -X POST "$SA/lines" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name":"Strict","keyword":"strict","mode":"relay","webhook_url":"https://my-agent.example.com/relay"}'

curl -s -X POST "$SA/lines" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name":"Claude","keyword":"claude","mode":"anthropic","api_key":"sk-ant-api03-…","system_prompt":"Be brief and kind."}'

curl -s -X POST "$SA/lines" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name":"Helper","keyword":"helper","mode":"openai","api_key":"sk-proj-abc123…","prompt_id":"pmpt_abc123"}'

Keys are encrypted at rest, never logged and never returned.

GET /lines

curl -s "$SA/lines" -H "Authorization: Bearer $KEY"

Returns {"data": [line, …]}. Deleted lines aren't included.

GET /lines/:id

curl -s "$SA/lines/line_…" -H "Authorization: Bearer $KEY"

PATCH /lines/:id

Changes the connector config, pauses or resumes the line, or changes caps and settings. Send only the fields you're changing. You can send any common field above, plus:

field
name Rename the line.
status "paused" or "active". Owner pauses are silent (or send paused_text) and can always be resumed. A line that is unpaid or has used its free replies returns 409 line_paused when you resume it.
keyword Only after keyword_released_at is set (see the line object).
mode Switch modes. The new mode's required fields must be present (sent now or already stored).
instructions / system_prompt Anthropic lines.
webhook_url, async, model, prompt_id, assistant_id, api_key
messages Your texter messages: {"messages": {"help": {"mode": "text", "text": "…"}}}. See Texter messages.
public_description Up to 280 characters for the line's program page, or null. A description our content check flags is a 400 content_rejected.
owner_url Your site (https only), shown as "Made by …" on the program page, or null.
webhook_secret Set your own secret.
rotate_webhook_secret: true We generate a new secret and return it once as webhook_secret.

An Arrow line is registered to its owner automatically (see Pricing); once its number has moved onto that registration, the line's plan reads "isv" (same price and terms). plan can't be changed here, and neither can keyword unless it was released; both return 400.

# pause
curl -s -X PATCH "$SA/lines/line_…" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"status":"paused"}'

# caps
curl -s -X PATCH "$SA/lines/line_…" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"daily_cap":200,"monthly_cap_usd":25}'

# new endpoint + new secret
curl -s -X PATCH "$SA/lines/line_…" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"webhook_url":"https://new.example.com/sms","rotate_webhook_secret":true}'

Texter messages

A handful of texts come from us rather than your agent. Each one can be our default, your own fixed text, or fetched from your endpoint. Send only the ones you're changing; null puts one back on our default. The full guide, with the checks and examples, is Customize what texters see.

key When it goes out Default
opt_in The first text anyone gets from the line. "Echo via Silver Arrows: Thanks for texting! … Info: silverarrows.dev/ECHO"
welcome After the keyword on the shared number. nothing
help When someone texts HELP or INFO. "Echo is an AI text assistant from Silver Arrows LLC. … Info: silverarrows.dev/ECHO"
stop When someone texts STOP. Twilio sends this one for every line today, so yours is stored but not sent yet. "Silver Arrows: You're unsubscribed …"
paused While you've paused the line. silence
unknown A text to your own number before the line passes its connection test. silence
fallback When your agent fails or times out (default or text only). "Sorry, I'm having trouble right now. …"

Each value is {"mode": "default"}, {"mode": "text", "text": "…"} (≤ 320 characters) or {"mode": "endpoint", "url": "…"?}.

curl -s -X PATCH "$SA/lines/line_…" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"messages":{"help":{"mode":"text","text":"Mission Bikes: an AI assistant by Silver Arrows LLC. Questions: help@missionbikes.example. Reply STOP to opt out. {link}"}}}'

Carriers require some words in three of them, so a text that misses any is a 400 naming what's missing:

  • opt_in: "Silver Arrows", the line's program link (write {link} and we fill it in), "Msg & data rates may apply", the message frequency ("Msg frequency varies"), and HELP and STOP instructions; at most 2 texts with the link in.
  • help: the line's name, "Silver Arrows LLC", the program link ({link}), a way to reach you (email, website or phone), and "Reply STOP to opt out"; at most 2 texts with the link in.
  • stop: that they won't get further messages, and START to resume.

endpoint mode POSTs {"type": "help", "line_id": "line_…", "sender_id": "snd_…"} to url (default: the line's webhook_url), signed like every other request, and sends the text you return (plain text or {"text": "…"}). It waits 3 seconds and caches the answer for 10 minutes. If your endpoint fails, or its text misses a required element, we send our default instead and log it.

DELETE /lines/:id

Marks the line deleted, cancels its subscription and releases its dedicated number into a 60-day cooling period, so old contacts can't reach the next owner. The keyword stays reserved.

curl -s -X DELETE "$SA/lines/line_…" -H "Authorization: Bearer $KEY"
# {"id":"line_…","status":"deleted","released_number":"+14155550123"}

POST /lines/:id/test

Sends a synthetic text from our test number through your agent and returns what it said. No SMS is sent. When the test passes, the line gets verified_at. Nothing goes live until this passes. The connect wizard calls this endpoint.

field
body Optional test message (default: a short hello).
curl -s -X POST "$SA/lines/line_…/test" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d '{}'
{
  "ok": true,
  "reply": "Hi! I'm Echo.",
  "latency_ms": 412,
  "error": null,
  "warnings": [],
  "outcome": "reply",
  "verified_at": "2026-10-05T12:01:00.000Z"
}

When the test fails, ok is false and error explains why in plain English, for example "Your endpoint returned 500" or "Your endpoint didn't answer within 10 seconds.". warnings lists problems that don't fail the test, for example "Reply was 612 characters; we'll split it unless you shorten it.", markdown that will be stripped, an agent that chose silence, or one that answered __async__. outcome is reply, silent, async or error.

GET /lines/:id/conversations

Returns threads, newest activity first, with their most recent messages. Results are paged with a cursor.

query
since ISO timestamp. Returns only threads active since then, and only messages since then.
limit Threads per page, 1–200 (default 50).
cursor The next_cursor from the previous page.
message_limit Most recent messages per thread, 1–200 (default 50). has_more_messages: true means older ones exist.

To read every thread, follow next_cursor until has_more is false:

curl -s "$SA/lines/line_…/conversations?limit=50" -H "Authorization: Bearer $KEY"
# {"data": [ … ], "has_more": true, "next_cursor": "eyJhdCI6…"}

Then request the same URL with &cursor=<next_cursor> added, and repeat. next_cursor is null on the last page.

curl -s "$SA/lines/line_…/conversations?since=2026-10-05T00:00:00Z" -H "Authorization: Bearer $KEY"
{
  "data": [{
    "id": "conv_…",
    "sender_id": "snd_3f9a…",
    "phone": null,
    "sender_display": "•••-•••-1234",
    "number_e164": "+14155550100",
    "opted_out": false,
    "consented_at": "…",
    "last_message_at": "…",
    "last_inbound_at": "…",
    "created_at": "…",
    "schedule_consent": null,
    "account_id": null,
    "has_more_messages": false,
    "messages": [
      { "id": "msg_…", "direction": "in", "body": "hi", "media_urls": [], "created_at": "…",
        "in_reply_to": null, "kind": null, "send_reason": null, "segments": 1, "delivery_status": null,
        "blocked_category": null },
      { "id": "msg_…", "direction": "out", "body": "Hello!", "media_urls": [], "created_at": "…",
        "in_reply_to": "msg_…", "kind": "agent", "send_reason": "reply", "segments": 1, "delivery_status": "delivered",
        "blocked_category": null }
    ]
  }],
  "has_more": false,
  "next_cursor": null
}

When a supported Twilio channel reports that the recipient opened an outbound message, its delivery_status becomes read. Standard SMS and MMS provide carrier delivery status only. Read receipts appear in conversation logs and API responses.

Outbound kind is agent (your agent's reply, billed), system (our texts: opt-in confirmation, notices), interim (the 👀 acknowledgment) or blocked: a reply our content policy stopped. Blocked replies were never sent (the texter got the fallback text); blocked_category says why, for example "harassment". Inbound messages have kind: null.

phone is the raw number only when the line has share_phone turned on. Connection-test threads are hidden.

GET /lines/:id/stats

Analytics for the line, computed from its logs (the same numbers as the dashboard's Analytics tab). Days are UTC and include today. Connection tests aren't counted.

query
range 7d, 30d (default) or 90d.
curl -s "$SA/lines/line_…/stats?range=7d" -H "Authorization: Bearer $KEY"
{
  "line_id": "line_…",
  "range": "7d",
  "since": "2026-09-29T00:00:00.000Z",
  "until": "2026-10-06T00:00:00.000Z",
  "days": [
    { "day": "2026-10-05", "inbound": 12, "replies": 11, "new_texters": 3, "opt_outs": 0,
      "failed_deliveries": 0, "connector_errors": 1 }
  ],
  "totals": { "inbound": 40, "replies": 38, "new_texters": 9, "opt_outs": 1, "failed_deliveries": 0, "connector_errors": 2 },
  "active_conversations": 7,
  "latency": { "count": 38, "p50_ms": 1840, "p95_ms": 6200 },
  "connector": { "attempts": 40, "failures": 2, "failure_rate": 0.05 },
  "top_errors": [{ "label": "Agent timed out", "kind": "connector_error", "code": "timeout", "count": 2, "hint": null }],
  "usage": { "month": "2026-10", "replies": 38, "...": "the same object as the line's usage" }
}

days has one entry per day of the range (zeros included). new_texters counts opt-ins (the keyword on the shared number, or a first text to your own number). replies are your agent's replies that we handed to the carrier; failed_deliveries are texts the carrier reported failed or undelivered. latency is the time from a text arriving to your agent's first reply to it (median and 95th percentile, milliseconds). connector.failure_rate is agent errors ÷ (texts your agent answered + agent errors); null when there were none. usage is the same object as the line's usage.

GET /lines/:id/logs

The line's debug log, newest first: each text in, the requests we made to your agent and the texts that went back out. Use it to answer "why didn't my bot reply?".

query
since ISO timestamp. Only entries from then on.
limit Entries per page, 1–200 (default 50).
cursor The next_cursor from the previous page.
status all (default), ok, error or no_reply. Filters each page, so a page can hold fewer than limit entries; keep following next_cursor until has_more is false.
curl -s "$SA/lines/line_…/logs?status=error&since=2026-10-05T00:00:00Z" -H "Authorization: Bearer $KEY"
{
  "data": [{
    "id": "msg_…",
    "at": "2026-10-05T12:00:00.000Z",
    "direction": "in",
    "status": "error",
    "conversation_id": "conv_…",
    "sender": { "id": "snd_3f9a…", "masked": "•••-•••-1234" },
    "test": false,
    "inbound": { "body": "hi", "media_count": 0, "segments": 1, "delivery_id": "SM…" },
    "connector_requests": [
      { "attempt": 1, "at": "…", "host": "agent.example.com", "status_code": 500, "duration_ms": 84, "error": null, "ok": false },
      { "attempt": 2, "at": "…", "host": "agent.example.com", "status_code": null, "duration_ms": 10000, "error": "timeout", "ok": false }
    ],
    "tool_calls": [],
    "outbound": [
      { "id": "msg_…", "at": "…", "kind": "system", "reason": "reply", "body": "Sorry, I can't answer right now.",
        "segments": 1, "delivery_id": "SM…", "delivery_status": "delivered", "error": "Your endpoint returned 500",
        "twilio_error_code": null, "hint": "Fallback text sent because the agent failed.", "latency_ms": 10230, "ok": true }
    ]
  }],
  "has_more": false,
  "next_cursor": null
}

status is error when your agent failed (every attempt), a reply was blocked or the carrier didn't deliver; no_reply when nothing went back (for example STOP, or your agent chose silence). Connector requests show the host only, never the path. (tool_calls is always empty now; it held tools-mode calls before that mode was removed.) Texters appear as their hashed sender.id and a masked number. twilio_error_code comes with a plain-English hint (for example 30007: carrier filtering). The connection test's thread is included and marked "test": true. Logs are kept for 90 days.

POST /lines/:id/reply

Lets an async agent (Tasklet, n8n, Make, a webhook that answered without a reply, or a relay that answered "__async__") reply. The reply is accepted only if in_reply_to is an inbound text in this conversation received in the last 5 minutes. If you omit in_reply_to, the conversation's latest inbound must be from the last 60 seconds.

field
conversation_id required
body required, 1–1600 chars. We split it, strip markdown and add footers.
in_reply_to the inbound message.id from the relay payload
curl -s -X POST "$SA/lines/line_…/reply" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"conversation_id":"conv_…","in_reply_to":"msg_…","body":"Your card today is the Star."}'
# {"ok":true,"message_ids":["msg_…"]}

Refusals return 403 with a code from the table above, for example outside_reply_window, opted_out or rate_limited.

Retries are safe. Send an Idempotency-Key header (any string up to 255 characters, for example your workflow's run id) and every retry with that key within 24 hours returns the first response, with the same message_ids, and texts nothing. The response then carries Idempotent-Replayed: true. Without the header, the same body for the same in_reply_to (or conversation) within 5 minutes is sent once. Reusing a key with a different body returns 422 idempotency_conflict. A refused request doesn't use up its key.

curl -s -X POST "$SA/lines/line_…/reply" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: n8n-run-8812" \
  -d '{"conversation_id":"conv_…","in_reply_to":"msg_…","body":"Filed: SF-1042"}'

POST /lines/:id/request_schedule_consent

Texts the sender our fixed prompt: "Reply YES to get scheduled texts from this line. Max 1/day. Reply STOP any time." The prompt is a reply, so it needs a recent inbound (60 s, or 5 min with in_reply_to). When they reply YES, consent becomes active. A pending prompt isn't re-sent within 24 hours. If consent is already active, nothing is sent.

curl -s -X POST "$SA/lines/line_…/request_schedule_consent" -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"conversation_id":"conv_…","in_reply_to":"msg_…"}'
# {"status":"pending","prompted":true,"message_id":"msg_…"}

Relay and webhook agents can return {"reply": "…", "request_schedule_consent": true} instead. Anthropic lines have a built-in request_schedule_consent tool.

POST /lines/:id/send

Sends a scheduled text that your own scheduler triggers. It's allowed only after the sender replied YES, and at most once per calendar day per sender. We add "Reply STOP to opt out." and apply the same length and content rules as replies. There is no send-to-many: one conversation_id per call.

curl -s -X POST "$SA/lines/line_…/send" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"conversation_id":"conv_…","body":"Your daily card: The Sun."}'
# 200 {"ok":true,"message_ids":["msg_…"]}
# 403 {"error":{"code":"no_consent","message":"This texter hasn't replied YES to scheduled texts from this line."}}

Possible refusals: no_consent, daily_limit, paused, opted_out, schedule_disabled, blocked_content, line_inactive and over_limit. /send is idempotent the same way as /reply (Idempotency-Key, or the same conversation and body within 5 minutes), so a retried send returns its first response instead of daily_limit.

GET /lines/:id/schedule_consents

Read-only.

curl -s "$SA/lines/line_…/schedule_consents" -H "Authorization: Bearer $KEY"
{ "data": [{ "conversation_id": "conv_…", "sender_id": "snd_…", "status": "active", "paused_reason": null,
             "last_scheduled_sent_at": "…", "last_inbound_at": "…", "created_at": "…", "updated_at": "…" }] }

status is pending, active, paused or revoked (after STOP).

Phone login

Tell your agent which account in your own app is texting. The full flow is Phone login.

Endpoint What
POST /lines/:id/login_codes {account_id, expires_in?} 201 with a one-time code, text_snippet and sms_link to show your logged-in user. expires_in: 60 to 3600 seconds, default 600. 409 line_not_live before the line's connection test passes.
GET /lines/:id/login_codes/:code_id status: pending, logged_in or expired; once logged in, logged_in_at, sender_id, conversation_id. Never the code.
GET /lines/:id/logins?account_id= Logged-in phones on the line, newest first: {data: [{account_id, sender_id, conversation_id, logged_in_at}]}.
DELETE /lines/:id/logins/:sender_id Log one phone out (your "Disconnect my phone" button). 404 when it wasn't logged in. Texters can also text LOGOUT.

Once a phone is logged in, every webhook/relay payload from it carries account_id, and so does its thread in GET /lines/:id/conversations.


Platforms

For platforms that provision numbers for their own users (the full guide, with curl for every step, is Platforms). Every endpoint below takes a platform key (Authorization: Bearer arrow_live_… created with the Platform scope) unless noted, answers with the same error envelope, and accepts Idempotency-Key on POSTs. An account that isn't an approved platform gets 403 platform_not_approved; a retail key gets 403 platform_key_required; a suspended platform gets 403 platform_suspended. Another platform's line is a 404.

Endpoint What
POST /platform/apply {company, use_case, website?, contact_name?, contact_email?, expected_numbers?} Apply (any retail key or the dashboard). 201 {"platform": {"status": "applied", …}}. GET /platform/apply shows the status.
GET /platform Your platform: status, contract terms, webhook (secret masked).
PATCH /platform {webhook_url?: string | null, rotate_webhook_secret?: true} Set, rotate or remove the webhook. Returns webhook_secret once when a new one is made.
POST /platform/lines Create a line for an end user: {name, external_customer_id, mode (webhook, relay, anthropic or openai; a webhook_url alone means webhook), …mode fields, messages?, keyword?, metadata?, auto_test?, test_message?}. Always a dedicated number. 201 with the line (+ webhook_secret once, + test with auto_test).
GET /platform/lines?external_customer_id=&status=&limit=&cursor= Your lines, oldest first. {data, has_more, next_cursor}.
GET /platform/lines/:id One line: the line object plus platform_id, external_customer_id, metadata, live, opt_in_confirmation and disclosure {url, text} (url is the line's short_link, its Silver Arrows program page).
PATCH /platform/lines/:id Everything PATCH /lines/:id takes, plus external_customer_id and metadata.
DELETE /platform/lines/:id Deletes the line; its number goes to cooling and billing for it stops.
POST /platform/lines/:id/test {body?} The connection test. The first pass makes the line live.
GET|POST /platform/lines/:id/{conversations,logs,stats,reply,send,request_schedule_consent,schedule_consents} The same as the /lines/:id/… endpoints above.
POST /platform/lines/:id/login_codes, GET /platform/lines/:id/login_codes/:code_id, GET /platform/lines/:id/logins, DELETE /platform/lines/:id/logins/:sender_id Phone login, the same as above.
GET /platform/usage?month=YYYY-MM Active-number days and replies per line, per external_customer_id and in total, the invoice so far on your contract, and (this month) a projection.
GET /platform/invoices Your monthly invoices, newest first, with Stripe's hosted invoice links.

Platform webhooks (line.went_live, line.test_failed, line.paused, number.released) are signed like relay: X-Arrow-Signature: sha256=<HMAC-SHA256 of the raw body>. Limits per platform key and account: 600 requests a minute, 500 new lines an hour, 1,000 tests an hour.


Setup (for agents)

GET /setup and POST /setup take a setup key (Authorization: Bearer arrow_setup_…), not an API key. The wizard puts one in the prompt it gives your AI tool (Let your agent set it up). A setup key works for 60 minutes, for one line, until that line goes live; it can't call any other endpoint (403 setup_token_scope).

Endpoint What
GET /setup The line's contract as JSON: the line (keyword, number), what we POST, how to answer, the signature check with the line's webhook_secret, and the texter-message rules.
POST /setup {url, mode?, messages?, name?, phone_login?} Points the line at url (mode webhook by default, or relay), sets messages (a string is shorthand for {"mode": "text", "text": …}), runs the connection test. 200 {ok, line, test: {reply, latency_ms, outcome, error, hint, warnings}, messages_set, kept_previous_connection, api_key?, next_steps}. ok: true means the line is live. When the endpoint answered later (outcome: "async") or the body has "phone_login": true, api_key holds a line key (arrow_live_…, shown once) that works only for this line's /reply, /send, /request_schedule_consent, /schedule_consents, /login_codes and /logins; running setup again replaces it.

Limits per setup key: 30 POSTs and 120 GETs an hour. Error codes: setup_token_expired, setup_token_revoked, setup_token_used, setup_token_invalid, setup_token_required.


API keys (dashboard only)

These endpoints accept only a signed-in dashboard session. An API key can't create or revoke keys and gets a 403. The dashboard's Account → API keys page uses them.

GET /api_keys {"data": [{id, name, prefix, created_at, last_used_at, revoked_at, scope, line_id}]}. scope "line" (with line_id) is a key agent setup made for one line.
POST /api_keys {name?, scope?} 201. Includes key (arrow_live_…) once. We store only a hash. scope is "retail" (default) or "platform" (approved platforms only, see Platforms).
DELETE /api_keys/:id (or DELETE /api_keys?id=…) Revokes the key. Revoked keys stop working immediately.