Migrate to AWS Partner Central 3.0 in 30 minutes.

Migrate now (opens in a new tab)
Skip to main content

Authenticate as a SaaSify user to get a bearer token, then send that token with every request.

Base URLs: https://api.saasify.ai (production). Test against https://api-demo.saasify.ai (demo). See Environments.

SaaSify uses the OAuth 2.0 resource-owner password grant. You exchange a SaaSify username and password for an opaque bearer token at POST /api/token, then send Authorization: Bearer <token> on each call. The token carries the user's tenant and role, so there are no separate API keys or scopes to manage today.

Use a dedicated service user

Create a SaaSify user whose only job is API access, give it a least-privilege role that covers the operations you call, and authenticate as that user — not as a person's account. The token inherits the user's full role permissions, so keep the role tight.

​Get a token

Send a form-encoded POST to /api/token with grant_type=password and the user's username and password. Add the TenantCode header if the user belongs to more than one tenant (see Multi-tenant users).

curl -X POST https://api-demo.saasify.ai/api/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -H "TenantCode: YOUR_TENANT_CODE" \
  --data-urlencode "grant_type=password" \
  --data-urlencode "username=service-user@example.com" \
  --data-urlencode "password=YOUR_PASSWORD"

The response is a standard OAuth token payload:

{
  "access_token": "a-long-opaque-token",
  "token_type": "bearer",
  "expires_in": 86400,
  "refresh_token": "another-opaque-token",
  "userName": "service-user@example.com",
  "isTenantUser": true,
  "onBehalfOf": null
}

The token is opaque — treat it as a string, do not try to decode it. It is valid for expires_in seconds (24 hours / 1,440 minutes in the current production configuration). Store it and reuse it until it expires rather than requesting a new token on every call.

Do not send the X-SaaSify-Client header. That header switches the token endpoint into the web app's cookie mode, which moves the tokens into HttpOnly cookies and removes them from the response body. API callers should leave it out and read the token from the body.

​Send the token

Put the token in an Authorization: Bearer header on every request:

curl https://api-demo.saasify.ai/api/subscriptions/list \
  -H "Authorization: Bearer $TOKEN"

The tenant comes from the token, so an authenticated call usually needs only the bearer token — no extra tenant headers.

​Refresh a token

When a token expires, exchange the refresh_token for a new one instead of asking the user for their password again. Use the same /api/token endpoint with grant_type=refresh_token:

curl -X POST https://api-demo.saasify.ai/api/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=refresh_token" \
  --data-urlencode "refresh_token=YOUR_REFRESH_TOKEN"

The response has the same shape as the password-grant response, with a fresh access_token.

​Multi-tenant users {#multi-tenant-users}

If a user belongs to a single tenant, you can omit TenantCode — the tenant is resolved from the user. If the user belongs to more than one tenant, send the TenantCode header to choose which tenant the token (and later requests) act in. You can get a user's tenant code from a Publisher Admin.

​SSO-only tenants

SaaSify users who sign in through single sign-on (Okta, Microsoft Entra ID, Google and similar) cannot use the password grant, because they have no SaaSify password. If your tenant enforces SSO for people, you still need one local service user with a password for API access. Create it under Settings → Users as an Add local user, give it an API-appropriate role, and use its credentials with the password grant above.

​What does not exist yet

  • No API keys and no client-credentials grant. Authentication is always as a user.
  • No OAuth scopes. Access is governed by the user's role permissions.
  • No per-ISV OAuth app registration and no request signing for your calls.

These are planned. When machine credentials ship, this page will cover them. Until then, the service-user pattern above is the supported approach.

Was this page helpful?