Skip to content
v3Latest
Feedback

Authenticate with API keys

Send your secret key as a bearer token. Keys can be limited to scopes and IP ranges.

On this page

Send your secret key as a bearer token. Keys can be limited to scopes and IP ranges. Follow the steps below — it takes just a few minutes.

Before you begin#

  • A Relay account and a test-mode API key
  • curl or one of the official SDKs

Steps#

  1. Add the header#

    Every request needs Authorization: Bearer rk_live_….

  2. Limit the scope#

    Give each service only the scopes it needs, such as messages:write.

  3. Restrict by IP#

    Optionally allow requests only from your servers’ IP ranges.

Tip

Never put a secret key in a mobile app or browser code.

Example#

POST /v3/messages
curl https://api.relay.example/v3/messages \
  -H "Authorization: Bearer $RELAY_KEY" \
  -d channel=sms \
  -d to=+15550100001 \
  -d body="Your code is 482913"

Still stuck?#

Include the request ID from the Relay-Request-Id response header — it lets us find your call in seconds.

Was this article helpful?