API reference
Upload a picture
POST /v1/attachments
Upload a picture to send with a chat message, as multipart/form-data with the agent_id and the file. Send its id in the message's attachment_ids. A picture nobody sends is deleted after six hours. Needs chats:write.
Body
Sent as multipart/form-data.
| Field | Type | Required | Description |
|---|---|---|---|
agent_id |
string (uuid) | Yes | The agent the picture is for. |
file |
string | Yes | A JPEG, PNG, WebP or GIF. |
Answer
201 with Attachment.
Errors
Every error is a problem document with a stable code.
| Status | When |
|---|---|
401 |
The key is missing, mistyped, unknown, revoked or expired. |
403 |
The key lacks a permission, a live key was sent from a browser, or the organization is frozen and the request would change something. |
404 |
This key reaches no such agent. |
409 |
The project is frozen. |
413 |
The picture is larger than the agent accepts. |
422 |
The agent does not accept pictures, or the file is not one. |
429 |
Too many requests for this key or its organization; see Retry-After. |
500 |
Something went wrong on our side. Quote the request_id to support. |
Examples
#!/bin/sh
# Upload a picture to send. Send the id it returns in a message's attachment_ids.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/attachments" \
-H "Authorization: Bearer $AIGENTLY_API_KEY" \
-F "agent_id=3c7d9e1f-5a2b-4c6d-8e0f-1a3b5c7d9e2f" \
-F "file=@photo.jpg;type=image/jpeg"
Try it
Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.