YepAPI
Instagram API

Media ID Lookup

Convert an Instagram post shortcode to its numeric media ID.

POST/v1/instagram/media-id
$0.01/call

Usage

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

ParameterTypeRequiredDescriptionDefault
shortcodestringYesPost shortcode from the Instagram URL

Response

{
  "ok": true,
  "data": {
    "shortcode": "C5xAbCdEfGh",
    "media_id": "3456789012345678901",
    "media_id_with_owner": "3456789012345678901_787132"
  }
}

Response Fields

FieldTypeDescription
okbooleanWhether the request succeeded
data.shortcodestringThe input shortcode
data.media_idstringNumeric media ID
data.media_id_with_ownerstringMedia 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.

On this page