Instagram API
Media ID Lookup
Convert an Instagram post shortcode to its numeric media ID.
POST
$0.01/call/v1/instagram/media-idUsage
const res = await fetch('https://api.yepapi.com/v1/instagram/media-id', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ shortcode: 'C5xAbCdEfGh' }),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/instagram/media-id \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"shortcode": "C5xAbCdEfGh"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
shortcode | string | Yes | Post shortcode from the Instagram URL | — |
Response
{
"ok": true,
"data": {
"shortcode": "C5xAbCdEfGh",
"media_id": "3456789012345678901",
"media_id_with_owner": "3456789012345678901_787132"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.shortcode | string | The input shortcode |
data.media_id | string | Numeric media ID |
data.media_id_with_owner | string | Media ID with owner ID suffix (format: {media_id}_{owner_id}) |
The shortcode is the unique identifier found in Instagram post URLs: https://www.instagram.com/p/{shortcode}/. This endpoint is useful when you need the numeric media ID for other API calls or integrations.