Skip to Content
kosemdocs
ReferenceAPIAgents

Upload agent file

Uploads a file to an agent, for a message to attach by its name. The body is the file, as it is, of the media type that Content-Type names; without one, or with application/octet-stream, kosem tells the type from the content. A file that no message attaches within a day is deleted; the others are kept with the agent. The agent's model reads an image, scaled down if it is larger than models read, and a PDF of at most 10 MiB, and of other files a description, by which the agent's tools open them. A file is at most 50 MiB, and an agent's files 1 GiB all told.

POST
/v1/projects/{project}/agents/{agent}/files

Uploads a file to an agent, for a message to attach by its name. The body is the file, as it is, of the media type that Content-Type names; without one, or with application/octet-stream, kosem tells the type from the content.

A file that no message attaches within a day is deleted; the others are kept with the agent. The agent's model reads an image, scaled down if it is larger than models read, and a PDF of at most 10 MiB, and of other files a description, by which the agent's tools open them. A file is at most 50 MiB, and an agent's files 1 GiB all told.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
agent*string

The agent's ID.

Match^ags_[0-7][0-9a-hjkmnp-tv-z]{25}$

Query Parameters

filename*string

The file's name, without a directory.

Length1 <= length <= 255

Request Body

The file, as it is, at most 50 MiB, of the media type that Content-Type names.

body*fileapplication/octet-stream
Formatbinary

Response Body

Created

application/json
  1. response
createTime*string

When it was uploaded.

Formatdate-time
creator*string

Who uploaded it, such as user:usr_….

filename*string

Its file name.

height?integer

An image's height, in pixels.

Formatint32
mediaType*string

Its media type, such as image/png or application/pdf.

modelReads*string

What the agent's model reads of the file in a message: CONTENT, the file itself, as an image or a document, which models that read neither get a placeholder for; or DESCRIPTION, its name, media type, size and ID alone, by which the agent's tools open it.

Value in"CONTENT""DESCRIPTION"
name*string

Resource name, projects/{project_id}/agents/{agent_id}/files/{file_id}, by which a message's file part attaches it.

sha256*string

The SHA-256 of its content, in hexadecimal.

sizeBytes*integer

Its size, in bytes.

Formatint64
width?integer

An image's width, in pixels.

Formatint32
Example Request
curl -X POST 'https://api.kosem.ai/v1/projects/string/agents/string/files?filename=string' \
  -H 'Content-Type: application/octet-stream' \
  -d 'string'
Example Response
{
  "createTime": "2019-08-24T14:15:22Z",
  "creator": "string",
  "filename": "string",
  "height": 0,
  "mediaType": "string",
  "modelReads": "CONTENT",
  "name": "string",
  "sha256": "string",
  "sizeBytes": 0,
  "width": 0
}