Skip to main content

Overview

The Partner API uses API Key authentication. Every request must carry a valid API Key issued by CleanLife. There is no OAuth flow, no JWT, and no session management required. The API Key acts as both your identity credential and your permission token. It is validated on every request.

How Authentication Works

  1. Include your API Key in the x-api-key request header on every request.
  2. The platform verifies that the key is valid, active, and associated with your partner account.
  3. If an IP allowlist is configured for your key, requests from other addresses are rejected.
  4. Your request rate is checked against your configured limit (if any).
  5. If a domain allowlist is configured on your account, browser-originated requests are validated against your registered domains.
  6. The platform checks that your key has the permission required for the endpoint you are calling.
  7. If all checks pass, your request proceeds.

Required Header

The key can also be passed as a query parameter api_key, but this is strongly discouraged because query parameters appear in server logs, proxy logs, and browser history.

API Key Format

API Keys are opaque strings generated by the platform. The exact format is internal and may vary. Do not parse or derive meaning from the key value.

Authentication Examples

cURL

JavaScript (Node.js / fetch)

Python (requests)

TypeScript (axios)

C#

PHP


Permissions Model

Each API Key is granted a set of permissions. If you attempt to call an endpoint without the required permission, you will receive a 403 Forbidden response.
Request only the permissions you actually need. Following the principle of least privilege reduces risk if your key is ever compromised.

Domain Allowlist (Optional)

If your partner account has allowed domains configured, the platform will additionally validate that incoming requests originate from one of your registered domains. Domain detection happens in the following priority order:
  1. Origin request header
  2. Referer request header
  3. x-partner-domain request header (optional fallback)
Behavior: This means server-to-server integrations (where there is no Origin or Referer header) are never blocked by the domain check, even when domains are configured.

Authentication Errors


Security Recommendations

  1. Never expose your API Key client-side. Store it as a server-side environment variable (e.g., CLEANLIFE_API_KEY).
  2. Rotate your key periodically. Contact the CleanLife team to issue a new key.
  3. Use HTTPS exclusively. Never call the API over plain HTTP.
  4. Log and monitor failed authentication responses (401, 403) to detect unauthorized usage.
  5. IP allowlist — ask the CleanLife team to restrict your API Key to specific egress IP addresses of your servers.
  6. Scope permissions carefully — request only the permissions your integration needs.