API Key
An API Key is an authentication method used to invoke the Cresc API within CI/CD pipelines or automated scripts. Compared to standard username/password logins, API Keys are much more secure and easier to manage.
Use Cases
- Continuous Integration/Deployment (CI/CD): Automate OTA update publishing via GitHub Actions, GitLab CI, Jenkins, etc.
- Automation Scripts: Write scripts to manage apps, versions, or native packages in bulk.
- Third-Party Integrations: Wrap Cresc's workflows into external developer tools.
Creating an API Key
- Log into the Cresc Dashboard
- Click on "API Key" in the left sidebar menu.
- Click the "Create API Key" button.
- Enter a name for the API Key (e.g., CI/CD Pipeline).
- Select the required permissions.
- (Optional) Set an expiration date.
- Click Create, and copy the secret API Key immediately.
The API Key string is only displayed once upon creation. You will not be able to view it again. Be sure to save it safely immediately!
Permissions
You must select at least one permission when creating a API Key. Applying the principle of least privilege is a best practice.
Using API Key with API
When calling the Cresc API, supply the API Key via the x-api-token HTTP header:
The header x-api-token and the environment variable CRESC_API_TOKEN are wire-level names kept unchanged for compatibility with existing integrations. The console and the docs call it an API Key — they are the same thing.
Using in the CLI
If you're using the react-native-update-cli tool (v2.7.0+), you can pass the API Key via environment variables:
Using in CI/CD Environments
Here is an example configuring a GitHub Action:
In CI/CD pipelines, always store your API Key securely using the platform's Secret Manager (e.g., GitHub Secrets) rather than hardcoding them in your configuration scripts.
Managing API Key
Viewing API Key List
On the "API Key" page, you can view all created API Key, including:
- API Key Name
- Permissions
- Expiration Time
- Last Used Time
- Status (Active/Expired/Revoked)
Revoking a API Key
If a API Key is leaked or no longer needed, you can revoke it at any time:
- Identify the API Key in the table list.
- Click the "Revoke" button.
- Confirm revocation.
Revocations take effect immediately. Any API requests made using a revoked API Key will be instantly rejected. Ensure you update any dependent CI/CD setups before revoking.
Security Practices
- Principle of Least Privilege: Only grant the exact permissions required.
- Set Expirations: Try to use short-lived API Key or configure expirations for temporary integration projects.
- Periodic Rotation: Routinely revoke old API Key and cycle in new API Key for long-running workflows.
- Secure Storage: Never commit API Key directly to your repository source code.
- Monitor Usage: Check the 'Last Used Time' and delete idle API Key routinely.
Limits
- Each user can create a maximum of 10 API Keys.
- To create additional API Key, you must first revoke existing unused API Key.