Authentication

Authenticate your requests with your API key and API secret, and send the business identifier where an endpoint requires it.

On this page

The Easyflow API authenticates requests with HTTP headers. There are no sessions or cookies: send your credentials with every request.

Credential headers

Header When to send it Description
x-api-key Every request API key provided on the Integrations tab of the Easyflow platform.
x-api-secret Every request API secret provided on the Integrations tab of the Easyflow platform.
business-id When the endpoint requires it Identifier of the business the request refers to.

Each endpoint page in the API reference lists the headers it expects in its Headers section.

curl --request GET \
  --url 'https://9iq81tsdy4.execute-api.sa-east-1.amazonaws.com/business/balance' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-api-secret: YOUR_API_SECRET' \
  --header 'business-id: YOUR_BUSINESS_ID'

The business identifier

Endpoints that act on a business, such as Get balance, Get order, Filter products and most payment link endpoints, take the business identifier in the business-id header. The requirement varies by endpoint, so check the Headers section of the endpoint you are calling.

You can list the businesses that belong to your account, and their identifiers, with List businesses by owner.

When a request sends business-id, the API checks the business before running the endpoint:

  • The value must be the identifier of a business. Any other value returns 400 with the message Invalid param: [businessId].
  • The user who owns the API key must be linked to the business. Most endpoints accept only a collaborator of the business. The payment link endpoints that take business-id and Get installment options accept a collaborator of the business, an active sales team seller, or an Easyflow platform administrator. Get subscription accepts a collaborator of the business or an Easyflow platform administrator. A user that is not linked to the business gets 403 Forbidden.
  • Send the business identifier in one header only. A request that sends business-id and x-business-id with different values gets 401 Unauthorized.

The endpoints that manage your payment links also accept the business identifier in the x-business-id header: Create payment link, Update payment link, List payments link, Active payment link, Inactive payment link, Delete payment link and Upload image payment link. On these endpoints, a request without either header gets 401 with BusinessId is required, and the other checks above apply to the header that was sent. business-id is the recommended header on these endpoints too, and the header to use on every other endpoint.

A few endpoints that create resources receive the business in the request body instead, in a businessId field. Create charge and Create customer are examples.

Authentication errors

When the credentials are missing or invalid, the API answers with 401 Unauthorized:

{
  "message": "Unauthorized",
  "error": "Unauthorized",
  "statusCode": 401
}

When the credentials are valid but cannot access the requested resource, the API answers with 403 Forbidden:

{
  "message": "Forbidden resource",
  "error": "Forbidden",
  "statusCode": 403
}

Keep your credentials safe

  • Call the API only from your server. Your API secret must never reach browsers, mobile apps or other client-side code.
  • Store the credentials in environment variables or in a secrets manager, never in source code.
  • Always send requests to the HTTPS base URL shown in the API reference.
  • Give access to the credentials only to the people and services that need them.