# Media

Endpoints for managing media files

## Get Media Attachments

> Retrieve media attachments from WhatsApp Business attachments service.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Media","description":"Endpoints for managing media files"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/whatsapp_business/attachments/":{"get":{"description":"Retrieve media attachments from WhatsApp Business attachments service.","operationId":"get-media-attachments","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Media attachments retrieved successfully"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Get Media Attachments","tags":["Media"]}}}}
```

## Get Media by ID

> Retrieve media URL and metadata by media ID. URL is valid for 5 minutes. Includes security validation.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Media","description":"Endpoints for managing media files"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"media_id.GetMediaURLResponse":{"description":"Response payload containing the media download URL and metadata","properties":{"file_size":{"type":"integer"},"id":{"type":"string"},"messaging_product":{"type":"string"},"mime_type":{"type":"string"},"sha256":{"type":"string"},"url":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/{media_id}":{"get":{"description":"Retrieve media URL and metadata by media ID. URL is valid for 5 minutes. Includes security validation.","operationId":"get-media-by-id","parameters":[{"description":"Media ID (must be numeric)","in":"path","name":"media_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/media_id.GetMediaURLResponse"}}},"description":"Media URL and metadata retrieved successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request - invalid media ID format"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Forbidden - missing permissions"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Too many requests - endpoint disabled"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Get Media by ID","tags":["Media"]}}}}
```

## Delete Media by ID

> Delete media content by media ID from Meta's storage.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Media","description":"Endpoints for managing media files"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"media_id.DeleteMediaResponse":{"description":"Response payload for successful media deletion","properties":{"success":{"type":"boolean"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/{media_id}":{"delete":{"description":"Delete media content by media ID from Meta's storage.","operationId":"delete-media-by-id","parameters":[{"description":"Media ID to delete (must be numeric)","in":"path","name":"media_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/media_id.DeleteMediaResponse"}}},"description":"Media deleted successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Too many requests - endpoint disabled"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Delete Media by ID","tags":["Media"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.360dialog.com/docs/messaging-api/api-reference/media.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
