Color theme

Quickstart

Create an API key and make your first requests.

Before you start

You need an owner or admin role in a Swite workspace with a connected WhatsApp channel: creating a lead checks its number on that channel.

1. Create an API key

In Swite, open Settings → Developers → API keys and choose New API key. Copy the key when it is shown: it is shown only once. Keep it on your server, as you would a password.

2. List your leads

Send the key as a bearer token:

curl https://api.swite.co/v1/leads \
  -H "Authorization: Bearer $SWITE_API_KEY"

The response is the first page of your leads, newest first. A 401 means the key was not accepted: see Authentication.

3. Create a lead

curl https://api.swite.co/v1/leads \
  -H "Authorization: Bearer $SWITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Ana Souza", "phone": "+55 62 98122 6055" }'

A 201 returns the new lead, with the id you use to read, update or delete it. The lead appears in Swite straight away.

Next steps

  • Errors lists every failure and what to do about it.
  • Leads covers every field and operation.
  • Rate limits says how many requests a key may make.