Get media

Retrieve a fresh download URL and metadata for a media file attached to a message, such as a document sent by a contact.

GET/media/:id

Authentication

This endpoint authenticates with your API key sent in the X-API-Key header (ek_live_... format). You can manage your API keys from the Dev Tools section of the dashboard.

Path parameters

ParameterTypeRequiredDescription
idIntegerRequiredNumeric id of the media item, as returned in the media array of message payloads and the message_created webhook.

Example request

bash
curl -X GET "https://api.eclecticlabs.com/api/external/v2/media/482" \
  -H "X-API-Key: ek_live_your_api_key_here"

Example response

json
{
  "media": {
    "id": 482,
    "url": "https://storage.googleapis.com/eclectic-media/documents/6f9a...c2.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Expires=7200&...",
    "filename": "cotizacion.pdf",
    "contentType": "application/pdf",
    "expiresAt": "2026-08-24T20:15:00Z"
  }
}

Notes

  • Media ids come from the media array returned by GET /contacts/:uuid/messages and by the message_created webhook.
  • url is a signed URL valid for 120 minutes; expiresAt indicates when it expires. Call this endpoint again to obtain a fresh URL.
  • filename and contentType may be null when the platform did not provide them (e.g. photos or voice notes). expiresAt is null for media hosted on permanent public URLs.
  • Possible errors: 401 (invalid or missing API key), 404 (media not found or it belongs to another business).