Search documentation
karat

+

K

User Documentation ↗

Upload Attachment

POST/api/v2/ontologies/attachments/upload

Upload an attachment to use in an action. Any attachment which has not been linked to an object via an action within one hour after upload will be removed. Previously mapped attachments which are not connected to any object anymore are also removed on a biweekly basis. The body of the request must contain the binary content of the file and the Content-Type header must be application/octet-stream.

Third-party applications using this endpoint via OAuth2 must request the following operation scopes: api:ontologies-write.

Query parameters

filename
string

The name of the file being uploaded.

Request body

body
string

Response body

AttachmentV2
object

Success response.

Hide children

Hide children

rid
string

The unique resource identifier of an attachment.

filename
string

The name of a File within Foundry. Examples: my-file.txt, my-file.jpg, dataframe.snappy.parquet.

sizeBytes
string

The size of the file or attachment in bytes.

mediaType
string

The media type of the file or attachment. Examples: application/json, application/pdf, application/octet-stream, image/jpeg

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ -H "Content-type: application/octet-stream" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/ontologies/attachments/upload?filename=My+Image.jpeg" \ -d '@/path/to/file'

Response

Copied!
1 2 3 4 5 6 { "rid": "ri.attachments.main.attachment.bb32154e-e043-4b00-9461-93136ca96b6f", "filename": "My Image.jpeg", "sizeBytes": 393469, "mediaType": "image/jpeg" }