Skip to content

Content API

The Content API provides an interface to create and manage content and revisions in QuantCDN. It allows you to publish, update, and unpublish content, manage assets, create redirects, and control caching behavior.

Method: Bearer Token

All API requests must include the following headers:

HeaderDescription
Quant-TokenYour project’s API token (found in your dashboard)
Quant-CustomerYour customer identifier
Quant-ProjectYour project identifier

These headers will be validated to ensure the request is authorized.

Example:

Terminal window
curl -H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
https://api.quantcdn.io/v1/ping

All API requests must be directed to:

https://api.quantcdn.io/v1/

The path is prefixed with the API version. If backwards-breaking changes are introduced, the version number will be incremented. Old versions of the API will be maintained and deprecated with advance notice.

Requests that return multiple items are paginated to 100 items by default. You can control pagination with these parameters:

ParameterTypeDescription
pageintegerPage number to retrieve
per_pageintegerNumber of items per page (default: 100)

Paginated API endpoints return data under a records key and include metadata with page, page_size, total_records, and total_pages.

URL: /v1

Method: POST

Description: Publish HTML content to a specific URL path.

{
"content": "<html><body><h1>My static web page</h1></body></html>",
"url": "/example-page",
"published": true,
"info": {
"author_name": "Joe Static",
"log": "Revision log message"
},
"headers": {
"content-type": "text/html"
}
}
PropertyTypeRequiredDescription
contentstringYesThe HTML content to publish
urlstringYesThe URL path where the content will be accessible
publishedbooleanNoWhether the content should be published (default: true)
infoobjectNoMetadata about the content
info.author_namestringNoName of the content author
info.logstringNoRevision log message
headersobjectNoCustom HTTP headers to serve with the content

Status Code: 200 OK

{
"message": "Content created successfully",
"url": "/example-page",
"revision": 1,
"assets": [
{
"url": "/banner.jpg",
"md5": "a1b2c3d4e5f6g7h8i9j0"
}
]
}

The response includes a list of assets detected in your content that already exist in Quant, so you only need to upload files that have changed or don’t exist.

URL: /v1

Method: POST

Description: Upload static assets like images, JavaScript, CSS, etc.

HeaderTypeRequiredDescription
Quant-File-UrlstringYesThe URL path where the file will be accessible
Quant-File-HeadersJSON stringNoCustom headers to serve with the file

Multipart form data with the file to upload.

Terminal window
curl -X POST https://api.quantcdn.io/v1 \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-File-Url: /images/banner.jpg" \
-F "filename=@./banner.jpg"

Status Code: 200 OK

{
"message": "File uploaded successfully",
"url": "/images/banner.jpg",
"revision": 1
}

URL: /global-meta

Method: GET

Description: Retrieve metadata about all files in your project.

Status Code: 200 OK

{
"global_meta": {
"records": [
{
"last_modified": "2023-07-01T10:21:11",
"meta": {
"url": "/about-us",
"type": "content",
"seq_num": 3,
"published": true,
"byte_length": 41750,
"published_md5": "1476374aafe25fb499729ee7e4505e62",
"date_timestamp": 1595240471,
"revision_count": 3,
"published_revision": 3,
"highest_revision_number": 3
}
}
],
"page": 1,
"page_size": 100,
"total_records": 1,
"total_pages": 1
}
}

URL: /url-meta

Method: POST

Description: Retrieve metadata for specific URLs.

{
"Quant-Url": ["/styles.css", "/about-us"]
}

Similar to the /global-meta endpoint but filtered to the requested URLs.

URL: /unpublish

Method: PATCH

Description: Unpublish content at a specific URL path.

HeaderTypeRequiredDescription
Quant-UrlstringYesThe URL path to unpublish
Terminal window
curl -X PATCH \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-Url: /path/to/unpublish" \
https://api.quantcdn.io/v1/unpublish

Status Code: 200 OK

{
"message": "Content unpublished successfully",
"url": "/path/to/unpublish"
}

URL: /publish/{revision_id}

Method: PATCH

Description: Restore a previous revision as the published version.

HeaderTypeRequiredDescription
Quant-UrlstringYesThe URL path of the content
Terminal window
curl -X PATCH \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-Url: /content" \
https://api.quantcdn.io/v1/publish/123

Status Code: 200 OK

{
"message": "Revision 123 published successfully",
"url": "/content"
}

URL: /redirect

Method: POST

Description: Create a redirect from one URL path to another.

{
"url": "/url/to/redirect",
"redirect_url": "/target/path",
"redirect_http_code": 301,
"published": true
}
PropertyTypeRequiredDescription
urlstringYesThe source URL path
redirect_urlstringYesThe destination URL path
redirect_http_codeintegerNoHTTP status code (default: 301)
publishedbooleanNoWhether the redirect is active (default: true)

Status Code: 200 OK

{
"message": "Redirect created successfully",
"url": "/url/to/redirect",
"redirect_url": "/target/path"
}

URL: /purge

Method: POST

Description: Purge content from edge caches.

HeaderTypeRequiredDescription
Quant-UrlstringNoURL path to purge (use /* for entire cache)
Cache-KeysstringNoSpace-separated cache tags/keys to purge
Soft-PurgebooleanNoIf true, mark as stale instead of deleting

Purge an individual content path:

Terminal window
curl -X POST \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-Url: /content" \
https://api.quantcdn.io/v1/purge

Purge the entire cache:

Terminal window
curl -X POST \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-Url: /*" \
https://api.quantcdn.io/v1/purge

Soft-purge a content path:

Terminal window
curl -X POST \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Quant-Url: /content" \
-H "Soft-Purge: true" \
https://api.quantcdn.io/v1/purge

Purge using cache keys:

Terminal window
curl -X POST \
-H "Quant-Customer: example-customer" \
-H "Quant-Project: example-project" \
-H "Quant-Token: your-project-token" \
-H "Cache-Keys: azbe5 gormb1" \
https://api.quantcdn.io/v1/purge

Status Code: 200 OK

{
"message": "Cache purged successfully",
"purged": ["/content"]
}
{
"error": "Invalid parameter",
"message": "URL parameter is required"
}
{
"error": "Unauthorized",
"message": "Invalid API token"
}
{
"error": "Not found",
"message": "Resource not found"
}

The Content API has a rate limit of 100 requests per minute per project. If you exceed this limit, you’ll receive a 429 Too Many Requests response.