Authentication
Every request to the Compressor API must include a valid API Key. This key uniquely identifies your account and grants access to all compression, optimization, and storage features. Requests without proper authentication — or made over unsecured channels — are rejected automatically.
The API supports two authentication methods: HTTP Basic Auth and Bearer Tokens. You may choose either depending on your stack, tooling, or preferred style.
HTTP Basic Authentication
With Basic Auth, you provide your API Key as the username. A password is not required, but many HTTP clients require the colon suffix to indicate an empty password.
curl -u your-api-key: https://api.compressor.app/1.0/accountThis method is convenient in command-line tools and simple scripts, as no additional headers are required.
Bearer Token Authentication
Alternatively, you may authenticate using the Authorization header. This approach is the most common in backend services, serverless functions, and production environments.
curl -H "Authorization: Bearer your-api-key" https://api.compressor.app/1.0/accountBearer authentication keeps credentials tidy and integrates well with most HTTP libraries out of the box.
Verifying Your Credentials
You can confirm that your API Key is valid by calling the Account endpoint:
GET https://api.compressor.app/1.0/accountA successful response indicates that authentication is configured correctly. If the key is missing, malformed, or revoked, the API will return an HTTP 401 Unauthorized status code with an explanatory error message.
HTTPS Required
All API calls must be made over HTTPS. Requests sent over unencrypted HTTP—or requests missing authentication entirely—are blocked for security reasons. This ensures your credentials, payloads, and output files remain protected at all times.
Notes for cURL Users
- The
-uflag passes Basic Auth credentials - Appending a colon to your API Key
your-api-key:prevents cURL from prompting you for a password - Avoid storing API keys in shell history; consider environment variables or secret managers