# Instagram Audio API

> Get an Instagram song or original audio, the reels that use it, trending audio, and search sounds, as JSON. 1 credit per call.

**Get a song or original audio from Instagram Reels**, **the reels that use it**, **what is trending**, and **search sounds** by name.

```
GET https://api.handlehaul.com/v1/audio/{audio}
GET https://api.handlehaul.com/v1/audio/{audio}/reels
GET https://api.handlehaul.com/v1/audio/trending
GET https://api.handlehaul.com/v1/search/audio?q=
```

- `GET /v1/audio/{audio}`: A song or original audio
- `GET /v1/audio/{audio}/reels`: Reels that use it
- `GET /v1/audio/trending`: Trending audio
- `GET /v1/search/audio?q=`: Find audio

**Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free.

## Parameters

| Parameter | In | Description |
|---|---|---|
| `audio` | path | Numeric audio id (from a reel's `audio.id` or an audio URL). |
| `q` | query | search: a song, artist or sound name. |
| `cursor` | query | `pagination.next_cursor` from the previous page. |
| `fresh` | query | `true` skips the cache. |

## Response

```json
{
  "data": [
    {
      "id": "1899325052268228",
      "title": "Cedar Leo",
      "artist": "Cedar River",
      "is_original": false,
      "duration_seconds": 179,
      "reel_count": 703000,
      "cover_url": "https://scontent.cdninstagram.com/…/audio-audio_trending:coffee:0.jpg"
    }
  ],
  "pagination": {
    "next_cursor": null,
    "has_more": false,
    "page_size": 15
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26943
  }
}
```

## Examples

```bash
curl "https://api.handlehaul.com/v1/audio/trending" -H "X-Api-Key: $HANDLEHAUL_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.handlehaul.com/v1/audio/trending",
                 headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30)
r.raise_for_status()
for a in r.json()["data"]:
    print(a["title"], a["artist"], a["reel_count"])
```

```javascript
const res = await fetch("https://api.handlehaul.com/v1/audio/trending", {
  headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY },
});
const { data: trending } = await res.json();
```

```php
$ch = curl_init("https://api.handlehaul.com/v1/audio/trending");
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("HANDLEHAUL_API_KEY")],
    CURLOPT_RETURNTRANSFER => true,
]);
$body = json_decode(curl_exec($ch), true);
print_r($body["data"]);
```

```go
req, _ := http.NewRequest("GET", "https://api.handlehaul.com/v1/audio/trending", nil)
req.Header.Set("X-Api-Key", os.Getenv("HANDLEHAUL_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer res.Body.Close()
var body map[string]any
json.NewDecoder(res.Body).Decode(&body)
fmt.Println(body["data"])
```

## FAQ

### How do I find trending Instagram sounds with an API?
Call `GET /v1/audio/trending`. Each audio has a title, artist, duration and `reel_count`; use `GET /v1/audio/{id}/reels` to see the reels using it.
