Contents
API v1 and Reseller API reference
The API v1 and the Reseller API of the previous platform keep working in CDNify for existing integrations. Their contracts are frozen: routes, parameters and responses are the same as before, including their English messages. New integrations should use the API v2.
Hosts
API v1 routes (/api/v1/…) are served on the API host. The Reseller API (/users…) is served on the Reseller API host, which also accepts API v1 requests made with the key of a user of any reseller.
- API v1 host
- https://api.cdnify.lat
- Reseller API host
- https://reseller.cdnify.lat
Authentication
Both APIs use HTTP Basic authentication without a session. The user name is the API key and the password can be any value that is not empty; by convention it is x.
curl 'https://api.cdnify.lat/api/v1/resources' \
-u "$CDNIFY_API_KEY:x"The API v1 takes the API key of a user. You can issue a new one in the customer portal, on the API tokens page: the previous key stops working at once and the new one is shown only once. The Reseller API takes the API key of the reseller.
Differences with the previous platform: keys are stored only as a keyed hash, and disabled accounts can no longer authenticate. Keys imported from the previous platform will have to be replaced after the move to the new platform; the date will be announced.
Examples read credentials from environment variables: replace them with your own values, never paste a secret into a shared script. CDNIFY_API_KEY, CDNIFY_RESELLER_API_KEY
Requests
API v1 bodies can be sent as a form (application/x-www-form-urlencoded) or as JSON. JSON is read only when Content-Type is exactly application/json: with a parameter such as charset=utf-8 the body is read as a form and the JSON is ignored. The Reseller API reads forms only.
Lists are not paginated: each list returns the whole collection. There are no idempotency keys, so check the result before you retry a request that creates something. A GET request to a URL that ends in / is redirected to the same URL without it.
Errors
Error responses keep the formats of the previous platform, which vary by route: an errors list or object with numeric codes, a message object or an error object. Each route below shows its literal responses. Messages are always in English, whatever the Accept-Language header says.
Domain error codes of the API v1, with their literal messages:
| Code | Message |
|---|---|
| 1001 | Alias and hostname are required |
| 1002 | Invalid alias |
| 1003 | Invalid resource origin |
| 1004 | Sorry, this resource has already been taken. Please choose a different name. |
| 1005 | An alias is required for a files resource |
| 1006 | Resource type is not valid. Valid options are mirror or files |
| 1007 | Resource type files can not have an origin |
| 1008 | User does not have files account |
| 1009 | Resource limit exceeded |
Rate limits
Routes marked as rate limited allow 1000 requests per hour per user and return the headers X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Above the limit they answer 429 with the plain text You have reached the rate limit.
Moving to the API v2
The API v2 offers the same capabilities with cursor pagination, one error format with stable codes, safe retries and tokens with scopes. Each route below links to its API v2 equivalent.
The main renames: a resource is a site, hostname is cdn_hostname, advanced_settings is settings with explicit units (such as cache_ttl_seconds), and the users of the Reseller API are customers under /api/v2/reseller/customers.
Resources
- Resources
7 operations
A resource is a CDN site of the API v1: its alias, origin, CDN hostname, custom domains and advanced settings.
- Cache
4 operations
Purges and cache statistics of a resource.
- Custom domains and certificates
8 operations
Custom domains of a resource, domain validation files and certificates.
- Statistics
4 operations
Bandwidth and HTTP error codes of your resources.
- Reseller API
7 operations
Users of a reseller, their limits and their usage periods. Served on the Reseller API host with the reseller API key.
- Files
4 operations
The Files product is no longer offered. These routes answer
410 Gone, and nothing is created or charged. - Provider callbacks
10 operations
Routes called by payment providers, the certificate authority and the former Files server, not by customers. They are listed so that no route of the previous platform goes undocumented.