Upload Attachment API

Upload files that can be referenced in Assistant conversations using their attachment IDs.

To use the API you need an API key. You can create API Keys in your Workspace settings: https://app.langdock.com/settings/workspace/products/api

cURL
curl --request POST \
  --url https://api.langdock.com/attachment/v1/upload \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file'

Request

This endpoint accepts multipart/form-data requests with a single file upload.

  • Method: POST

  • Path: /attachment/v1/upload

  • Content-Type: multipart/form-data

  • Authorization (string, required) — API key as Bearer token. Format: "Bearer YOUR_API_KEY"

Body

  • file (file, required) — The file to upload

Response

200 application/json — Successfully uploaded file

Response JSON:

Field details:

chevron-rightattachmentIdhashtag
  • Type: string (uuid)

  • Required: yes

  • Description: Unique identifier for the uploaded attachment

chevron-rightfilehashtag
  • Type: object

  • Required: yes

Child attributes:

  • file.name — string, required — Original filename

  • file.mimeType — string, required — MIME type of the file

  • file.sizeInBytes — integer, required — Size of the file in bytes

Example usage

  • Use the returned attachmentId in the Assistant API by including it in the attachmentIds array at the assistant level or message level.

Error handling

chevron-rightExample (Node.js)hashtag

Possible status codes:

  • 400 — No file provided

  • 401 — Invalid API key

  • 500 — Server error