v1
GET
Attachments
Attachments
Attachments are files (photos, audio, video, documents) linked to records. Use these endpoints to list attachments and get temporary download URLs.
GET /v1/attachments
List attachments, optionally filtered by record.
# All attachments
curl -H "X-API-Key: mk_live_..." \
"https://<ref>.supabase.co/functions/v1/api-gateway/v1/attachments"
# Attachments for a specific record
curl -H "X-API-Key: mk_live_..." \
"https://<ref>.supabase.co/functions/v1/api-gateway/v1/attachments?record_id=rec_abc123"
Query parameters:
| Parameter | Description |
|---|---|
record_id |
Filter by record ID |
page |
Page number (default 1) |
per_page |
Items per page (default 50, max 500) |
Response:
{
"ok": true,
"data": [
{
"id": "att_001",
"type": "attachment",
"record_id": "rec_abc123",
"file_name": "site_photo_001.jpg",
"mime_type": "image/jpeg",
"size_bytes": 2457600,
"metadata": {
"width": 4032,
"height": 3024,
"geotag": {"type": "Point", "coordinates": [-73.985, 40.758]}
},
"created_at": "2026-02-15T14:31:00Z",
"updated_at": "2026-02-15T14:31:00Z"
}
],
"pagination": { "total": 5, "page": 1, "per_page": 50, "total_pages": 1 }
}
GET /v1/attachments/:id/url
Get a signed download URL for an attachment file. The URL is valid for 1 hour.
curl -H "X-API-Key: mk_live_..." \
"https://<ref>.supabase.co/functions/v1/api-gateway/v1/attachments/att_001/url"
Response:
{
"ok": true,
"data": {
"id": "att_001",
"file_name": "site_photo_001.jpg",
"mime_type": "image/jpeg",
"url": "https://your-project.supabase.co/storage/v1/object/sign/attachments/...",
"expires_in": 3600
}
}
Use the url field to download the file directly. The URL expires after expires_in seconds (1 hour). Request a new URL when needed.
Downloading Files
# Get the signed URL
URL=$(curl -s -H "X-API-Key: mk_live_..." \
"https://<ref>.supabase.co/functions/v1/api-gateway/v1/attachments/att_001/url" \
| jq -r '.data.url')
# Download the file
curl -o photo.jpg "$URL"
Need help with the API? Contact our support team.