Skip to content

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
spaceKeystring

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.

fileKeystring

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

The Content-Type used during creation of a file will be the same Content-Type header included in responses when downloading the file.

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.txt
Authorization: Bearer <YOUR TOKEN>
h-metadata-author: Joseph Ritson
h-fields-category: poems
Content-Type: text/plain
Roses are red
Violets are blue,
Sugar is sweet
And so are you.
Response
Status: 200
Content-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
spaceKeystring

Must be a non-empty string containing a-z, 0-9, period or underscore.

fileKeystring

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.txt
Authorization: Bearer <YOUR TOKEN>
Response
Status: 200
Content-Type: text/plain
h-metadata-author: Joseph Ritson
h-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
spaceKeystring

Must be a non-empty string containing a-z, 0-9, period or underscore.

fileKeystring

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.txt
Authorization: Bearer <YOUR TOKEN>
Response
Status: 200