开发人员控制台
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Amazon Music Device API

Request Headers

Overview

HTTP request headers are typically sent with every request to the API and include important required parameters such as authorization information used for authentication. They can contain additional optional information which may do things such as specify the size of images to return. When making requests to Playback APIs, there are some additional request headers that are necessary. These are detailed below.

Headers table

The following HTTP Request headers are supported by Amazon Music's Web API endpoints:

Header Required? Description
Content-Type For POST requests Whenever the client sends a POST request with a JSON payload, the header should be set to "application/json."
Authorization Yes A bearer token obtained from the Login With Amazon authorization service
Accept-Language No A valid language code (see Localization for list)
amzn-image-style No Resizes images to fit the longer side of a fixed specified resolution.
X-Amzn-Audio-DRMType For playback A comma separated list of supported DRM solutions. Only supported value currently: WIDEVINE
X-Amzn-Audio-Device-Capability For playback A comma separated list of supported playback qualities. See below for details.
X-Amzn-Device-Id For playback A unique serial number for the specific device making the request.
We recommend using an identifer that doesn't change across sessions, e.g. the hash value of an MAC address.

Accept-Language

Please see the section on Language Localization for details.

Authorization

For information on obtaining a bearer authorization token, see Login With Amazon (LWA).

Ex: Authorization: Bearer Atza|...

DRM Type

The X-Amzn-Audio-DrmType request header specifies which DRM solution to use for streaming HD and Spatial audio. At this time, Amazon Music only supports Widevine.

Ex: X-Amzn-Audio-DrmType = WIDEVINE

Audio Quality

The X-Amzn-Audio-Device-Capability request header specifies the audio quality levels supported by your device as a comma-separated list.

These are the audio quality levels currently supported by Amazon Music:

  • STD_RES
    • Standard-quality playback using OPUS over Dash.
    • Bit rates at low, medium, and high are 48, 192, and 320 kbps respectively.
  • HI_FI
    • HD-quality playback using FLAC over DASH.
    • 16 bits, from 44.1 kHz.
  • HI_RES
    • Ultra HD-quality playback using FLAC over DASH.
    • 24 bits, from 44.1 kHz to 192 kHz.
  • THREE_DIMENSIONAL
    • Dolby Atmos-quality using DD+.
    • 16 bit.
  • REAL_AUDIO_360
    • Reality Audio 360 quality over MPEG-H.
    • 16 bit.

For Example: X-Amzn-Audio-Device-Capability = STD_RES,HI_FI,HI_RES Avoid any blank spaces.

Image Styles

The amzn-image-style header resizes images to fit the longer side to the specified resolution: Supported values are: SL500 (500 px), SL160 (160 px), SL110 (110 px), SL75 (75 px), SL30 (30 px)

The prefix "SL" stands for "Scaling to Longest dimension".

If you need to specifiy a different resolution or require multiple image sizes, but want to avoid multiple requests to the API, you can pass the wildcard character *. This special value will insert a placeholder within the image URL paths returned by the API, e.g. https://m.media-amazon.com/images/X/l6Hv/M/ll6HvRXOi7j9s76._*_.jpg. This mechanism enables you to replace the placeholder in the image URL with any resolution ad-hoc and, if required, download multiple sizes of the same image.