# Instagram URL Resolver

> Turn any Instagram link (profile, post, reel, story, highlight, hashtag, place or audio) into its type and ids with a free API call. Shortcode to media id included.

**Turn any Instagram link into its type and ids, free.** Profiles, posts, reels, stories, highlights, hashtags, places and audio links are all recognised, and a post shortcode is converted to its numeric media id. The answer also tells you which Klupt API route to call next.

```
GET https://api.klupt.io/v1/resolve?url={instagram_url}
```

**Cost:** free (no data is fetched). Needs an API key.

## Response

```json
{
  "data": {
    "type": "post",
    "shortcode": "C9xYzAbCdEf",
    "id": "3500000000000000123",
    "api": "/v1/posts/C9xYzAbCdEf"
  },
  "meta": { "request_id": "req_…", "credits_charged": 0 }
}
```

`type` is one of `user`, `post`, `story`, `highlight`, `hashtag`, `place` or `audio`.

## Examples

```bash
curl -G "https://api.klupt.io/v1/resolve" --data-urlencode "url=https://www.instagram.com/reel/C9xYzAbCdEf/" -H "X-Api-Key: $KLUPT_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.klupt.io/v1/resolve", params={"url": "https://www.instagram.com/p/C9xYzAbCdEf/"},
                 headers={"X-Api-Key": os.environ["KLUPT_API_KEY"]}, timeout=30)
print(r.json()["data"]["id"])
```

```javascript
const url = new URL("https://api.klupt.io/v1/resolve");
url.searchParams.set("url", "https://www.instagram.com/explore/tags/coffee/");
const { data } = await (await fetch(url, { headers: { "X-Api-Key": process.env.KLUPT_API_KEY } })).json();
```

## FAQ

### How do I convert an Instagram shortcode to a media id?
Call `GET /v1/resolve?url=` with the post link: `id` is the numeric media id. The conversion is exact and costs nothing.
