--- title: Attachments | API Docs description: Send images, videos, documents, and audio as media parts. --- The Linq API supports sending rich media files including images, videos, documents, audio, and contact cards. There are two ways to include media in your messages. For the basics of sending messages, see [Sending Messages](/guides/messaging/sending-messages/index.md). For iMessage voice memos with inline audio playback, see [Voice Memos](/guides/messaging/voice-memos/index.md). ## Direct URL (up to 10MB) Provide a publicly accessible HTTPS URL directly in a `media` message part. This is the simplest approach for most use cases: Terminal window ``` curl -X POST https://api.linqapp.com/api/partner/v3/chats/{chat_id}/messages \ -H "Authorization: Bearer $LINQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": { "parts": [ { "type": "text", "value": "Check out this photo!" }, { "type": "media", "url": "https://example.com/photo.jpg" } ] } }' ``` ``` await client.chats.messages.send(chatId, { message: { parts: [ { type: 'text', value: 'Check out this photo!' }, { type: 'media', url: 'https://example.com/photo.jpg' }, ], }, }); ``` ``` client.chats.messages.send( chat_id, message={ "parts": [ {"type": "text", "value": "Check out this photo!"}, {"type": "media", "url": "https://example.com/photo.jpg"}, ], }, ) ``` > **Note:** MIME type is inferred server-side from the file. You do not need to pass a `mime_type` on media parts. > **Note:** The URL must be publicly accessible via HTTPS with a valid SSL certificate. The API downloads the file from the URL before sending. ## Pre-upload (up to 100MB) For larger files or files you send repeatedly, use the three-step pre-upload flow: ### Step 1: Request a pre-signed upload URL Terminal window ``` curl -X POST https://api.linqapp.com/api/partner/v3/attachments \ -H "Authorization: Bearer $LINQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "filename": "photo.jpg", "content_type": "image/jpeg", "size_bytes": 245760 }' ``` ``` const attachment = await client.attachments.create({ filename: 'photo.jpg', content_type: 'image/jpeg', size_bytes: 245760, }); ``` ``` attachment = client.attachments.create( filename="photo.jpg", content_type="image/jpeg", size_bytes=245760, ) ``` `filename`, `content_type`, and `size_bytes` are all **required**. The response includes: - `attachment_id` — permanent ID to reference in media parts (never expires) - `upload_url` — presigned URL to PUT the file to (expires in 15 minutes) - `download_url` — permanent CDN URL for the uploaded file - `http_method` — always `PUT` - `expires_at` — when `upload_url` expires - `required_headers` — headers you **must** send on the upload request exactly as returned (S3 rejects the upload otherwise) See the [Create Attachment](/api/resources/attachments/methods/create/index.md) endpoint for the full response. ### Step 2: Upload the file PUT the raw file bytes to `upload_url`. You **must** include every header from `required_headers` exactly as returned — the URL is signed against those values: Terminal window ``` curl -X PUT "${upload_url}" \ -H "Content-Type: image/jpeg" \ --data-binary @photo.jpg ``` The body is the binary file content — not JSON, not multipart form data. ### Step 3: Send the message with the attachment Reference the `attachment_id` in your message: Terminal window ``` curl -X POST https://api.linqapp.com/api/partner/v3/chats/{chat_id}/messages \ -H "Authorization: Bearer $LINQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": { "parts": [ { "type": "media", "attachment_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" } ] } }' ``` > **Tip:** Attachment IDs never expire — reuse them across multiple messages without re-uploading. This is ideal for logos, templates, or frequently sent media. ## Supported file types | Category | Formats | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | **Images** | JPEG, PNG, GIF, HEIC, HEIF, TIFF, BMP | | **Videos** | MP4, MOV, M4V, MPEG, MPG, 3GP | | **Audio** | M4A, AAC, MP3, WAV, AIFF, CAF, AMR | | **Documents** | PDF, TXT, RTF, CSV, ZIP, EPUB, HTML, HTM, Microsoft Office (DOC, DOCX, XLS, XLSX, PPT, PPTX), Apple iWork (PAGES, NUMBERS, KEY) | | **Contacts & Calendar** | VCF, ICS | **Not supported:** WebP, SVG, FLAC, OGG, and executable files are explicitly rejected. ## File size limits | Method | Max size | | ---------- | -------- | | Direct URL | 10 MB | | Pre-upload | 100 MB | ## CDN domain Uploaded files and media in webhook payloads are served from `cdn.linqapp.com`. Add this domain to your allowlist if you have network restrictions.