> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Instagram オーディオを検索

> Reel に添付する楽曲を Instagram のライセンス済みオーディオカタログから検索する

キーワードで Instagram のオーディオカタログを検索します。返された `audioId` を [`instagramOptions.audioConfiguration`](https://www.ayrshare.com/docs/apis/post/social-networks/instagram#adding-music-to-a-reel) で使用すると、Reel の公開時にその楽曲を添付できます。

> [!WARNING]
>
> **Requires Instagram linked through Facebook Login.** Instagram's Audio API is only available to accounts connected via **Facebook Login**, which needs a Facebook Page connected to the Instagram account. Accounts connected with **Instagram Login** (the Ayrshare default) cannot search, look up, or attach audio, and every audio request returns `code: 514`.
>
> This is a Meta restriction, not an Ayrshare one. Meta's documentation states the Audio API "is only available on the Instagram API with Facebook Login. It is not supported on the Instagram API with Instagram Login." No permission or plan upgrade changes it.
>
> **Three things are required:**
>
> 1. An Instagram **Business** or **Creator** account
>
> 2. A **Facebook Page connected** to that Instagram account
>
> 3. Instagram linked to Ayrshare with **Instagram Login disabled**, so the Facebook Login flow is used
>
> See the [step-by-step setup guide](https://www.ayrshare.com/docs/dashboard/connect-social-accounts/instagram.md#music-attach-eligibility-facebook-login-required).

## ヘッダーパラメータ

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## クエリパラメータ

**query** `string` *required*

アーティスト名や楽曲名などの検索キーワード。空の値や空白のみの値は `code: 101` を返します。

**audioType** `string` (default: music)

検索対象のカタログ。ライセンスされた商用楽曲は `music`、他のクリエイターの Reels から取得されたオーディオは
`original_sound` を指定します。それ以外の値は `code: 101` を返します。

**limit** `integer`

返される楽曲の最大数で、`1` から `100` までです。整数でない値や範囲外の値は `code: 101` を返します。
省略した場合は、Instagram 自身のデフォルトが適用されます。

## レスポンスフィールド

Instagram はすべての楽曲についてすべてのフィールドを返すとは限らないため、`audioId` 以外のすべての楽曲フィールドはオプションとして扱ってください。

**status** `string`

検索が完了した場合は `success`。カタログに一致がない場合も成功として扱われます。

**query** `string`

検索されたキーワードがそのまま返されます。

**audio** `array`

一致した楽曲。空の配列は、検索は実行されたものの何も一致しなかったことを意味します。

**楽曲フィールド**

**audioId** `string`

Reel の公開時に `audioConfiguration.audioId` として渡す ID。

**title** `string`

楽曲のタイトル。

**displayArtist** `string`

Instagram が表示するアーティスト名。

**durationMs** `integer`

楽曲の長さ（ミリ秒）。

**thumbnailUrl** `string`

カバーアートワークのサムネイル URL。

**audioType** `string`

`music` または `original_sound` のいずれか。

**isAdsEligible** `boolean`

その楽曲を広告で使用できるかどうか。ライセンスされた音楽は、オーガニックな Reel では利用可能でも、
広告では利用できないことがよくあります。

```json 200: Success theme={"system"}
{
  "status": "success",
  "query": "summer",
  "audio": [
    {
      "audioId": "17901234567890123",
      "title": "Summer Nights",
      "displayArtist": "The Example Band",
      "durationMs": 32000,
      "thumbnailUrl": "https://scontent.example.com/cover.jpg",
      "audioType": "music",
      "isAdsEligible": true
    }
  ]
}
```

```json 200: No matches theme={"system"}
{
  "status": "success",
  "query": "asdfghjkl",
  "audio": []
}
```

```json 400: Instagram Login account theme={"system"}
{
  "status": "error",
  "code": 514,
  "action": "post",
  "message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
  "platform": "instagram"
}
```

## エラー

| Code | 意味 |
| - | - |
| 101 | `query` の欠落または空、認識されない `audioType`、または 1 から 100 の範囲外の `limit`。 |
| 156 | Instagram がこのプロファイルに連携されていません。 |
| 161 | Instagram の認可が期限切れになったか取り消されました。アカウントを再連携してください。 |
| 239 | 利用できない楽曲を含む、アカウントレベルの理由により Instagram がリクエストを拒否しました。検索では、照会エンドポイントが返す 517 ではなく 239 が報告されます。 |
| 258 | Instagram が不正な形式のレスポンス、またはマッピングされていない失敗を返しました。 |
| 425 | 接続に必要な Instagram の権限が不足しています。再連携してすべての権限を付与してください。 |
| 435 | Instagram のレート制限に達しました。しばらく待ってから再試行してください。 |
| 514 | Instagram が Instagram Login で連携されています。Audio API には Facebook Login が必要です。 |

コード 514 から 518 については [Instagram Reels オーディオエラー](https://www.ayrshare.com/docs/errors/errors-ayrshare.md#instagram-reels-audio-errors) で説明されています。その他については [Ayrshare エラーリファレンス](https://www.ayrshare.com/docs/errors/errors-ayrshare.md) を参照してください。

## 次のステップ

> [card] [楽曲を Reel に添付する](https://www.ayrshare.com/docs/apis/post/social-networks/instagram.md#adding-music-to-a-reel)

> [card] [単一の楽曲を照会する](https://www.ayrshare.com/docs/apis/media/get-instagram-audio.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.