> ## 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 オーディオメタデータを取得

> audioId を指定して Instagram のオーディオ楽曲を 1 件取得し、タイトルやアートワークを返します。保存済み ID の有効性確認にも便利です。

`audioId` を指定して、1 つのオーディオ楽曲の詳細を取得します。保存済みの ID がまだ有効かを確認したり、公開前に楽曲のタイトルとアートワークを表示したりするために使用します。

> [!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`

## パスパラメータ

**audioId** `string` *required*

[オーディオ検索](https://www.ayrshare.com/docs/apis/media/search-instagram-audio.md) が返す楽曲 ID。Instagram が認識しない ID は
`code: 517` を返します。

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

楽曲のフィールドは、ネストされるのではなく、レスポンスオブジェクトの直下にフラットに返されます。Instagram はすべての楽曲についてすべてのフィールドを返すとは限らないため、`audioId` 以外のすべてのフィールドはオプションとして扱ってください。

**status** `string`

楽曲が見つかった場合は `success`。

**audioId** `string`

楽曲 ID がそのまま返されます。

**title** `string`

楽曲のタイトル。

**displayArtist** `string`

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

**durationMs** `integer`

楽曲の長さ（ミリ秒）。

**thumbnailUrl** `string`

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

**audioType** `string`

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

**isAdsEligible** `boolean`

その楽曲を広告で使用できるかどうか。

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

```json 400: Track unavailable theme={"system"}
{
  "status": "error",
  "code": 517,
  "action": "post",
  "message": "The selected audio track is unavailable. It may be an invalid audio id, restricted in your region, or not licensed for this use. Please choose a different track using the Instagram audio search endpoint and try again.",
  "platform": "instagram"
}
```

> [!NOTE]
>
> **利用可否は地域に依存します。** Meta は、存在しない ID、アカウントの地域でライセンスされていない ID、
> この用途でライセンスされていない ID に対して同じエラーを返します。3 つのケースはいずれも `517` として
> 報告されるため、あるアカウントでは解決できる楽曲が、別のアカウントでは正当に失敗することがあります。
> 保存済みの ID がまだ有効であると想定せず、照会して確認してください。

## エラー

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

コード 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] [楽曲を検索する](https://www.ayrshare.com/docs/apis/media/search-instagram-audio.md)

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


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