Skip to main content

Upload an Attachment

Overview

In this guide we will show you how to upload an attachment in an existing conversation.

Prerequisites

  • apiKey: The API key you want to use. (Get Assistant API Key)
  • assistantId: The ID of the assistant you want to refer to.
  • conversationId: The ID of the conversation you want to upload the attachment to. (Create a Conversation)
  • conversationToken: The token of the conversation you want to upload the attachment to. (Create a Conversation)

Request

Endpoint

Make a POST request to the following endpoint:

https://api.pupau.ai/chat-bots/:assistantId/conversations/:conversationId/attachments 

Request Headers

Api-Key: <apiKey>
Conversation-Token: <conversationToken>

Request Body

{
"type": "IMAGE",
"file": your_file
}
  • type: The type of the attachment. Can be one of:

    • "TEXT" - For text files like .txt, .md, etc.
    • "IMAGE" - For image files like .jpg, .png, etc.
    • "CSV" - For spreadsheet files like .xlsx and .csv
  • file: The file you want to upload. Must be in FormData format.

Response

You will receive a JSON with the attachment created, here's an example:

{
"id": "attId",
"createdAt": "2025-01-01T12:00:00.000Z",
"createdBy": null,
"updatedAt": "2025-01-01T12:00:00.000Z",
"updatedBy": null,
"link": "",
"fileName": "example.txt",
"extension": "txt",
"summary": false,
"tokenCount": 5,
"ragId": null,
"type": "TEXT",
"previousQueryId": null,
"conversationId": "conv1",
"companyId": "comp1",
"userId": "user1"
}