# Instagram Shortcode to Media ID API

> Convert an Instagram post shortcode (from instagram.com/p/<shortcode>/) into the numeric media ID required by the Instagram post, comments and likes APIs.

Source: https://www.sandbase.ai/model/instagram/v1/shortcode-to-media-id
API reference: https://www.sandbase.ai/model/instagram/v1/shortcode-to-media-id/docs

## Facts

- Provider: Instagram
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/instagram/v1/shortcode-to-media-id`
- Price: $0.0015 per call
- Free allowance: 100 calls per organization per UTC day, shared across eligible APIs
- Capabilities: api, instagram
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/instagram/v1/shortcode-to-media-id` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `shortcode` | string | yes |  |

## FAQ

### How do I use the Instagram Shortcode to Media ID API?

Send a POST request to https://api.sandbase.ai/v1/api/instagram/v1/shortcode-to-media-id with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Instagram Shortcode to Media ID API cost?

$0.0015 per call. Every organization gets 100 free calls per UTC day, shared across eligible SandBase APIs including this one; after that each call is billed at this price from your SandBase balance. There is no subscription.

### What parameters does the Instagram Shortcode to Media ID API accept?

Required: shortcode (string). The Parameters table and the Playground on this page list every field.

### What does the Instagram Shortcode to Media ID API return?

A JSON response returned in the same HTTP request (synchronous). The README on this page includes a sample response.

### Do I need a Instagram developer account or API key?

No. Instagram Shortcode to Media ID runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Instagram API access separately.

## README

### Instagram Shortcode to Media ID API

Pass the shortcode from an Instagram post or reel URL and get its numeric media ID.

#### Use cases

- Resolve post links into media IDs.
- First step before fetching comments or likers.
- Deduplicate posts across sources.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/api/instagram/v1/shortcode-to-media-id" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"shortcode": "DRhvwVLAHAG"}'
```

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `shortcode` | string | Yes | Post shortcode |

#### Example response

Real response for the request above, trimmed to the main fields. User names and long IDs are masked.

```json
{
  "media_id": "3774507992167247878",
  "status": true
}
```

#### Related APIs

- [Get cities by country](/model/instagram/v1/cities): Get cities/regions list of specified country.
- [Get posts by hashtag](/model/instagram/v1/hashtag-posts): Get posts under specific hashtag.
- [Get location info](/model/instagram/v1/location-info): Get detailed information of specified location.
