Skip to content

Content API

Content API

Overview

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.

Authentication

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

Base URL

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.

Pagination

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.

Endpoints

Send Content

URL: /v1

Method: POST

Description: Publish HTML content to a specific URL path.

Request Body

{
"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

Response

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.

Upload Asset

URL: /v1

Method: POST

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

Request Headers

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

Request Body

Multipart form data with the file to upload.

Example

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"

Response

Status Code: 200 OK

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

Get Metadata

URL: /global-meta

Method: GET

Description: Retrieve metadata about all files in your project.

Response

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
}
}

Get URL Metadata

URL: /url-meta

Method: POST

Description: Retrieve metadata for specific URLs.

Request Body

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

Response

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

Unpublish Content

URL: /unpublish

Method: PATCH

Description: Unpublish content at a specific URL path.

Request Headers

HeaderTypeRequiredDescription
Quant-UrlstringYesThe URL path to unpublish

Example

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

Response

Status Code: 200 OK

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

Restore Previous Revision

URL: /publish/{revision_id}

Method: PATCH

Description: Restore a previous revision as the published version.

Request Headers

HeaderTypeRequiredDescription
Quant-UrlstringYesThe URL path of the content

Example

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

Response

Status Code: 200 OK

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

Create Redirect

URL: /redirect

Method: POST

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

Request Body

{
"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)

Response

Status Code: 200 OK

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

Purge Cache

URL: /purge

Method: POST

Description: Purge content from edge caches.

Request Headers

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

Examples

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

Response

Status Code: 200 OK

{
"message": "Cache purged successfully",
"purged": ["/content"]
}

Error Responses

400 Bad Request

{
"error": "Invalid parameter",
"message": "URL parameter is required"
}

401 Unauthorized

{
"error": "Unauthorized",
"message": "Invalid API token"
}

404 Not Found

{
"error": "Not found",
"message": "Resource not found"
}

Rate Limits

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.

See Also