Skip to main content
All API endpoints require authentication via a Bearer token in the Authorization header. Keys start with the gx_ prefix.

Using your API key

curl https://api.magica.com/api/v1/models \
  -H "Authorization: Bearer gx_your_api_key"
Create and manage keys from Settings → API Keys in the Magica app.

Creating a key

1

Sign in

Open app.magica.com and sign in.
2

Open Settings

Click the Settings button at the bottom of the left sidebar.
Account menu showing the Settings button highlighted
3

Open API Keys

Select the API Keys tab in the settings sidebar, then click Manage.
Settings sidebar with the API Keys tab highlighted
API Keys settings panel with the Manage button highlighted
4

Create the key

Click Create Key, enter a label (e.g. “Production”), and optionally set an expiration date.
5

Copy the key

Copy the full key immediately — it’s only shown once.
The full API key is only displayed at creation time. Store it securely. If you lose it, revoke the key and create a new one.

Key properties

You can create up to 10 API keys per account. Each key has its own label, rate limits, and optional expiration.
PropertyDescription
LabelA unique name for this key (editable anytime)
PrefixThe visible gx_... prefix shown in the dashboard
Rate limit (per minute)Max requests per minute for this key (default: 60)
Rate limit (per day)Max requests per day for this key (default: 1000)
Expires atOptional expiration date — key stops working after this date
Created atWhen the key was created

Managing keys

Edit a key

Update label or rate limits from Settings → API Keys. Click the pencil icon next to any key.

Revoke a key

Click the revoke button next to any key. Revocation is immediate — requests using that key start returning 401.
Revoking a key does not affect other keys on your account. Your other keys continue working normally.

Key expiration

You can optionally set an expiration date when creating a key. After it passes:
  • The key is automatically invalidated by the system
  • API requests using the key return 401 Unauthorized
  • The key shows an “Expired” badge in the dashboard
  • You can revoke expired keys to clean up your list
Use expiration dates for temporary integrations, CI/CD pipelines, or contractor access. For long-lived production keys, leave the expiration empty.

Rate limits

Each API key has its own rate limits that you can configure:
LimitDefaultRange
Per minute60 requests1 – 10,000
Per day1,000 requests1 – 100,000
When you exceed a rate limit, the API returns a 429 Too Many Requests response with a Retry-After header:
{
  "error": "Rate limit exceeded. Please try again later.",
  "message": "Rate limit exceeded. Please try again later.",
  "code": "RATE_LIMITED",
  "traceId": "req_..."
}
Rate-limit info is included in response headers:
HeaderDescription
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetTimestamp (ms) when the rate limit resets
Retry-AfterSeconds to wait before retrying (on 429 responses)
Use exponential backoff when retrying after a 429. If you consistently hit limits, raise the rate on that key in the dashboard, or create separate keys for different services.

Error responses

StatusMeaning
401Missing, invalid, revoked, or expired API key
429Rate limit exceeded
{
  "error": "Invalid or expired API key.",
  "message": "Invalid or expired API key.",
  "code": "UNAUTHORIZED",
  "traceId": "req_..."
}