API authentication and base URL

Help Center › API keys & connections › API authentication and base URL

API authentication and base URL

How to send your access key as a Bearer token, the starting address, and a first test with the ping route.

All requests use JSON and an access key.

Before you start

  • A key (see Creating access keys and choosing scopes).
  • Your website must be reachable over https://.
  • Plan inclusion for Connect other tools.

The base address

https://YOURSITE/wp-json/dreamscaper/v1/api/v1/

The exact base address is also shown on the How it works tab as Starting address, with a Copy button. Zapier routes sit next to it at https://YOURSITE/wp-json/dreamscaper/v1/zap/.

If your site does not use pretty permalinks, WordPress also accepts ?rest_route=/dreamscaper/v1/api/v1/ping (a standard WordPress feature).

Sending the key

Send it in the Authorization header:

Authorization: Bearer vsk_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

An X-API-Key header is also accepted as a fallback. Prefer Bearer.

Steps: a first test

  1. Open a terminal or an API testing tool.
  2. Run:
curl https://YOURSITE/wp-json/dreamscaper/v1/api/v1/ping \
  -H "Authorization: Bearer YOUR_KEY"
  1. A good answer is JSON with "object": "ping" and "ok": true. It also includes your business name, the key’s name, prefix and scopes, and your rate allowance.
  2. The ping route needs no scope. Any valid key works.

What happens on every call

Checks run in this order:
1. Key present and valid (401).
2. Key not turned off (401).
3. Your plan includes the feature (402).
4. You are under the hourly limit (429).
5. The key has the scope the route needs (403).

Calls that fail the scope check still count towards your hourly limit.

Response headers

Every answer carries X-Request-Id. When a limit applies it also carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix time).

Tips

  • Never put the key in a web page or app that customers can open.
  • Keep keys in environment variables, not in code.
  • Quote the X-Request-Id when you ask for help.
  • Requests that change data may send an Idempotency-Key. See Idempotency-Key.

If something goes wrong

  • 401 with missing_key: the header was not received. Some hosts strip it. The code also checks the server’s redirect variable, but if your host removes it, ask them to pass the Authorization header through.
  • 401 invalid_key: the key is mistyped.
  • 401 key_revoked: it was turned off.

Related articles

Still need help?

Tell us what you were trying to do and a person will reply.

Contact support