Quickstart
This guide gets you from zero to a working Saperly line fast.
The goal is simple: provision one line, receive one inbound interaction, and confirm you can control the response path.
Before you start
You need:
- a Saperly account
- an API key
- a public HTTPS URL if you are using webhook mode
Base URL:
Auth header:
Paste this into your AI coding agent
If you use Claude Code, Cursor, or any AI coding assistant, paste this prompt and it will set everything up:
Copy this entire block into your agent. It has everything needed to give your AI a phone number.
Option A: fastest possible setup, hosted mode
Hosted mode is the easiest onboarding path because you do not need to run a webhook server first.
1. Create a line
2. Save the returned phone number and line ID
You will use the phone number to place a real test call.
3. Call the number
Verify:
- the call connects
- the AI answers
- the opening message plays
- the transcript appears on the call record
sk_live_ not sk_test_, (2) your balance is above 0, (3) the line status is active. Run GET /api/v1/lines to verify.4. Inspect the created line
5. Inspect the resulting call
If this worked, you already have a production-shaped happy path.
Option B: webhook mode, your backend decides responses
Use this when your app already has an agent runtime or business logic you need to keep in your own stack.
1. Create a line
2. Add the smallest useful webhook
3. Call the number
Say one sentence. You should hear the echo response spoken back.
GET /api/v1/webhooks/deliveries to see what happened.4. What your webhook receives
5. What your webhook should return
6. Verify the signature
Every outbound webhook is signed. Verify before you trust the body.
See webhook mode — signature verification for the full headers table, replay-defense rules, and secret rotation flow.
Make one outbound call
If the line has compliance_enabled: true, outbound calls require consent first.
403 with consent_required. See Compliance and Consent to decide whether to turn it on.1. Grant consent
2. Start the call
Send one SMS reply
Inbound SMS arrives at your webhook as an sms_received event:
403 with conversation_window_expired.Send a reply:
What to verify before you keep building
Common first-day mistakes
- Using the wrong host. Use
https://saperly.com/api/v1. - Forgetting consent before outbound calling.
- Returning plain text instead of JSON in webhook mode.
- Taking too long to reply to a
messageevent. - Mixing up hosted mode and webhook mode fields on the same line.
