Skip to content

Authentication

The Cyan API is a JSON API with three endpoints. Every request is authenticated with your API key.

https://api.cyan.cash/v1

The /v1 in the path is the version. Changes to it only ever add things, so your integration keeps working.

Send your key as a bearer token on every request:

const response = await fetch(
"https://api.cyan.cash/v1/payment-links/pl_019d0a1b2c3d4e5f60718293a4b5c6d7",
{ headers: { Authorization: `Bearer ${process.env.CYAN_API_KEY}` } },
);

Create your key in the Cyan app under API keys. You’ll need to connect your Stripe account first, and be an admin of the business.

The key is shown once, when you create it. Store it in your server’s environment or a secrets manager.

Each business has one key. If you lose it, or think it has leaked, select Regenerate on the same page. The old key stops working immediately, so update your server right away.

Your API key can create payments for your business, so treat it like a password:

  • Call the API only from your backend.
  • Never put the key in a web page, a mobile app or a public repository.

Your chat page doesn’t need the key. It receives a payment link’s url from your server, and the customer pays inside Cyan’s checkout.

A key that starts with cyan_test_ is a test key. Its payments run in Stripe’s sandbox and move no money. See Test your integration.

Status code What to do
401 api_key_missing Send the Authorization header.
401 invalid_api_key Check the key. If you regenerated it, use the new one.
403 provider_not_connected Your key works, but your Stripe account isn’t connected. Connect it in the app under Settings → Connectors.

See Errors for every error code.