Admin API: Space exports
Operations to export the contents of a space to a single file. Common rules (authentication, error format, dates and times) are in the Admin API reference.
In the examples, replace <hostname> with the hostname of your environment and <access token> with an access token that starts with hako_pat_. Replace other values in angle brackets, such as <slug>, with the values described in each operation’s parameter table.
| Operation | Method and path |
|---|---|
| List space exports | GET /admin/api/spaces/{slug}/exports |
| Start a space export | POST /admin/api/spaces/{slug}/exports |
| Get an export | GET /admin/api/spaces/{slug}/exports/{id} |
| Delete an export record and its ZIP | DELETE /admin/api/spaces/{slug}/exports/{id} |
| Download the exported ZIP | GET /admin/api/spaces/{slug}/exports/{id}/download |
List space exports
Section titled “List space exports”Returns up to 20 items, newest first.
GET /admin/api/spaces/{slug}/exports- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space |
Responses:
| Status | Body | Reason |
|---|---|---|
200 |
TransferList (application/json) |
|
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/exports" \ -H "Authorization: Bearer <access token>"Start a space export
Section titled “Start a space export”Returns 409 if an export of the same space is queued or running.
POST /admin/api/spaces/{slug}/exports- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space |
Request body (application/json):
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
mediaFiles |
boolean or null | Whether to include media contents (included by default) |
Responses:
| Status | Body | Reason |
|---|---|---|
202 |
TransferView (application/json) |
|
400 |
Error (application/json) |
An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues |
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
409 |
Error (application/json) |
An export of the same space is queued or running |
415 |
Error (application/json) |
Content-Type: application/json is missing |
422 |
Error (application/json) |
The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key) |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl -X POST "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/exports" \ -H "Authorization: Bearer <access token>" \ -H "Content-Type: application/json" \ -d '{}'Get an export
Section titled “Get an export”GET /admin/api/spaces/{slug}/exports/{id}- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space | |
id |
path | string | Yes | ID |
Responses:
| Status | Body | Reason |
|---|---|---|
200 |
TransferView (application/json) |
|
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/exports/<id>" \ -H "Authorization: Bearer <access token>"Delete an export record and its ZIP
Section titled “Delete an export record and its ZIP”Deletes the export record and the ZIP. Queued or running ones cannot be deleted (409).
DELETE /admin/api/spaces/{slug}/exports/{id}- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space | |
id |
path | string | Yes | ID |
Responses:
| Status | Body | Reason |
|---|---|---|
204 |
None | |
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
409 |
Error (application/json) |
Queued or running |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl -X DELETE "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/exports/<id>" \ -H "Authorization: Bearer <access token>"Download the exported ZIP
Section titled “Download the exported ZIP”Returns 404 for exports that are not finished, have expired, or were deleted.
GET /admin/api/spaces/{slug}/exports/{id}/download- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space | |
id |
path | string | Yes | ID |
Responses:
| Status | Body | Reason |
|---|---|---|
200 |
File (application/zip) |
|
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/exports/<id>/download" \ -H "Authorization: Bearer <access token>"