attachment_type_not_supported

A file's real type (read from its bytes) is not one the channel accepts. Nothing was sent.

HTTP 422The request was understood but refused as sent. Change it before retrying.

When it fires

One of the files is of a type the conversation's channel does not accept. The type is read from the file's own bytes, not from contentType, the file name or the URL, so renaming a file or declaring a different type does not change the answer.

  • Airbnb accepts JPEG, PNG, GIF and WebP images (all delivered as JPEG) and MP4 and QuickTime video.
  • Booking.com accepts JPEG and PNG only.

index names the file and channel the channel. Nothing was sent.

Response shape

Every Repull error follows the same envelope. The code is stable and safe to switch on.

{
  "error": {
    "code": "attachment_type_not_supported",
    "message": "Attachment 1 is video/mp4, which booking does not accept. Nothing was sent.",
    "fix": "On booking send one of: image/jpeg, image/png. The type is read from the file itself, not from `contentType` or the URL.",
    "docs_url": "https://repull.dev/docs/errors/attachment_type_not_supported",
    "request_id": "req_01J5X7Y8Z9ABCDEF12345678",
    "field": "attachments[1]",
    "channel": "booking",
    "index": 1
  }
}

How to fix

  1. Read `channel` and `index` to see which file the channel refused.
  2. Convert that file to a type the channel accepts: JPEG or PNG for Booking.com; JPEG, PNG, GIF, WebP, MP4 or QuickTime for Airbnb.
  3. For documents such as PDFs, which neither channel accepts as a file, put a link to the document in `message` instead.
  4. Send the request again.

Examples

curl

# A PDF house manual cannot travel as a file: link to it instead
curl -X POST https://api.repull.dev/v1/conversations/164743/messages \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Here is the house manual: https://cdn.example.com/house-manual.pdf"}'

TypeScript

const ACCEPTED: Record<string, string[]> = {
  airbnb: ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'video/mp4', 'video/quicktime'],
  booking: ['image/jpeg', 'image/png'],
}

// Check before sending, using the type of the file you actually have
function canAttach(channel: string, fileType: string) {
  return (ACCEPTED[channel] ?? []).includes(fileType)
}

If you're an AI agent

The channel does not accept this file's real type (read from its bytes). Nothing was sent. Convert the file named by `index` to an accepted type (Booking.com: JPEG/PNG; Airbnb: JPEG/PNG/GIF/WebP/MP4/QuickTime) or send a link to it in the text.

Hit an error that isn't covered? Email hello@repull.dev with the request id from the response headers.

AI