> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getreply.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Media

> Send files, and download files people send you.

## Send a file

Send an image, video, audio or document by **https link**, inside the 24-hour window. We fetch the file from your link.

```bash cURL theme={null}
curl https://api.getreply.in/v1/messages/media \
  -H "Authorization: Bearer gr_live_…" \
  -H "Idempotency-Key: invoice-4521" \
  -H "Content-Type: application/json" \
  -d '{"to": "+9198250*****", "type": "document", "url": "https://example.com/invoice-4521.pdf", "filename": "invoice-4521.pdf"}'
```

```javascript Node.js theme={null}
const res = await fetch("https://api.getreply.in/v1/messages/media", {
  method: "POST",
  headers: {
    "Authorization": "Bearer gr_live_…",
    "Idempotency-Key": "invoice-4521",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+9198250*****",
    "type": "document",
    "url": "https://example.com/invoice-4521.pdf",
    "filename": "invoice-4521.pdf"
  }),
});
console.log(await res.json());
```

```php PHP theme={null}
<?php
$ch = curl_init("https://api.getreply.in/v1/messages/media");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer gr_live_…",
    "Idempotency-Key: invoice-4521",
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => '{"to": "+9198250*****", "type": "document", "url": "https://example.com/invoice-4521.pdf", "filename": "invoice-4521.pdf"}',
]);
echo curl_exec($ch);
```

```python Python theme={null}
import requests

res = requests.post(
    "https://api.getreply.in/v1/messages/media",
    headers={
        "Authorization": "Bearer gr_live_…",
        "Idempotency-Key": "invoice-4521",
    },
    json={
        "to": "+9198250*****",
        "type": "document",
        "url": "https://example.com/invoice-4521.pdf",
        "filename": "invoice-4521.pdf"
    },
)
print(res.json())
```

If we can't open the link you get `media_unreachable`; if it is too big, `media_too_large`. Sizes are on [Limits](https://docs.getreply.in/guides/limits.md).

## Download a file someone sent you

A `message.received` webhook with a file has `media.id`. Ask for its link:

```bash cURL theme={null}
curl https://api.getreply.in/v1/media/MEDIA_ID \
  -H "Authorization: Bearer gr_live_…"
```

```javascript Node.js theme={null}
const res = await fetch("https://api.getreply.in/v1/media/MEDIA_ID", {
  method: "GET",
  headers: {
    "Authorization": "Bearer gr_live_…",
  },
});
console.log(await res.json());
```

```php PHP theme={null}
<?php
$ch = curl_init("https://api.getreply.in/v1/media/MEDIA_ID");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer gr_live_…",
  ],
]);
echo curl_exec($ch);
```

```python Python theme={null}
import requests

res = requests.get(
    "https://api.getreply.in/v1/media/MEDIA_ID",
    headers={
        "Authorization": "Bearer gr_live_…",
    },
)
print(res.json())
```

The answer has a signed `url` that needs no key and stops working after a short time. Download it straight away.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.