Files API Reference
PUT /resources/files/<spaceKey>/<fileKey>
Creates or updates/overwrites an existing file. The body of the request must contain the content of the file being uploaded. Requires write
permission.
If the file already exist, it’s content, metadata and fields will be replaced by the new values. Fields and metadata will not be merged. Note that the fileId
will remain the same.
URI Parameters
spaceKey | string The space to put the file in. Spaces are created implicitly upon the first file being added. Must be a non-empty string containing a-z, 0-9, period or underscore. |
fileKey | string The key of the file. Is used to reference the file specific file. Can include forward slash to simulate a path. Each segment of the path must be a non-empty string containing a-z, 0-9, period or underscore. A segment of ”.” or ”..” is not allowed. |
Headers
Content-Type | string The |
h-metadata-<key> | string Named metadata fields can be included during creation of the File. These headers will be included in the response when downloading the file. |
h-field-<key> | string Named fields are available in the Graph. They are not included in the response when doanloading the file, but is meant to be used for internal management of files. |
Request Sample
Request
PUT https://<hantera-hostname>/resources/files/my-space/poem.txtAuthorization: Bearer <YOUR TOKEN>h-metadata-author: Joseph Ritsonh-fields-category: poemsContent-Type: text/plain
Roses are red Violets are blue,Sugar is sweet And so are you.
curl -i -X PUT \ https://<hantera-hostname>/resources/files/my-space/poem.txt \ -H 'Authorization: Bearer <YOUR TOKEN>' \ -H 'h-metadata-author: Joseph Ritson' \ -H 'h-fields-category: poems' \ -H 'Content-Type: text/plain' \ -d 'Roses are red Violets are blue,Sugar is sweet And so are you.'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/files/my-space/poem.txt" `-Method PUT `-Headers @{Authorization="Bearer <YOUR TOKEN>"; 'h-metadata-author'="Joseph Ritson"; 'h-fields-category'="poems"; 'Content-Type'="text/plain"} `-Body 'Roses are red Violets are blue,Sugar is sweet And so are you.'
Response
Status: 200Content-Type: application/json; charset=utf-8
{ "fileId": "89009400-246d-4503-9cb8-a0590a649cd0", "fileKey": "poem.txt", "spaceKey": "my-space", "mimeType": "text/plain", "size": 66, "createdAt": "2025-05-15T09:33:09.3074652+00:00", "dynamic": {}}
GET /resources/files/<spaceKey>/<fileKey>
Gets a file if the current session has read
access to it.
URI Parameters
spaceKey | string Must be a non-empty string containing a-z, 0-9, period or underscore. |
fileKey | string The key of the file. Can include forward slash to simulate a path. Each segment of the path must be a non-empty string containing a-z, 0-9, period or underscore. A segment of ”.” or ”..” is not allowed. |
Request Sample
Request
GET https://<hantera-hostname>/resources/files/my-space/poem.txtAuthorization: Bearer <YOUR TOKEN>
curl -i -X GET \ https://<hantera-hostname>/resources/files/my-space/poem.txt \ -H 'Authorization: Bearer <YOUR TOKEN>'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/files/my-space/poem.txt" `-Method GET `-Headers @{Authorization="Bearer <YOUR TOKEN>"}
Response
Status: 200Content-Type: text/plainh-metadata-author: Joseph Ritsonh-metadata-name: poem.txt
Roses are red Violets are blue,Sugar is sweet And so are you.
DELETE /resources/files/<spaceKey>/<fileKey>
Deletes an existing File if the current session has write
access to it.
URI Parameters
spaceKey | string Must be a non-empty string containing a-z, 0-9, period or underscore. |
fileKey | string The key of the file. Can include forward slash to simulate a path. Each segment of the path must be a non-empty string containing a-z, 0-9, period or underscore. A segment of ”.” or ”..” is not allowed. |
Request Sample
Request
DELETE https://<hantera-hostname>/resources/files/my-space/poem.txtAuthorization: Bearer <YOUR TOKEN>
curl -i -X DELETE \ https://<hantera-hostname>/resources/files/my-space/poem.txt \ -H 'Authorization: Bearer <YOUR TOKEN>'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/files/my-space/poem.txt" `-Method DELETE `-Headers @{Authorization="Bearer <YOUR TOKEN>"}
Response
Status: 200