Skip to main content
POST
/
agent-sessions
/
{session_id}
/
upload
Upload and link document
import requests

url = "https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/upload"

files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "api_metadata": "<string>" }
headers = {"X-API-KEY": "<api-key>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');
form.append('api_metadata', '<string>');

const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>'}};

options.body = form;

fetch('https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
curl --request POST \
--url https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: <api-key>' \
--form file='@example-file' \
--form 'api_metadata=<string>'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "status": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "file_type": "<string>",
  "processing_pipeline": "<string>",
  "error_message": "<string>",
  "api_metadata": {},
  "file_name": "<string>",
  "markdown_content": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

X-API-KEY
string
header
required

Headers

X-End-User-ID
string | null

Path Parameters

session_id
string<uuid>
required

Body

multipart/form-data
file
file
required
api_metadata
string | null

Custom API metadata (JSON string).

Response

Successful Response

id
string<uuid>
required

The unique identifier for the document.

name
string
required

The display name of the document.

status
string
required

The current processing status of the document.

created_at
string<date-time>
required

The timestamp when the document was created.

updated_at
string<date-time>
required

The timestamp when the document was last updated.

file_type
string | null

The MIME type of the document file.

processing_pipeline
string | null

The name of the processing pipeline used for this document.

error_message
string | null

If processing failed, this field will contain the error message.

api_metadata
Api Metadata · object | null

Custom API metadata resolved for the current user. Useful for retrieving stored external references (e.g. {'internal_app_ref': 'REF-123'}). Note: This value is resolved based on the request's external_user_id. A document shared globally but also scoped to a specific user may return different metadata depending on who is asking.

file_name
string | null

The original file name of the document.

markdown_content
string | null

The full content of the document converted to Markdown format.