# Soundtrack API

Soundtrack is a music streaming platform built for business. The Soundtrack API lets you build apps that show, control and monitor the music playing in your locations. Learn more [about Soundtrack](https://www.soundtrack.io/) and get [ideas for using the API](https://www.soundtrack.io/our-api/).

:::note
You'll need a [Soundtrack account](https://app.soundtrack.io/signup) and an API token to get started. Request the token in the Soundtrack app under [Settings > API](https://app.soundtrack.io/accounts/_/settings/api); you need permission to manage the account's settings and users. The Soundtrack API is free for all Soundtrack users.

:::

This guide covers how to call the Soundtrack API: authentication, requests, queries, subscriptions, mutations, errors and rate limits. New to the API? Start with [Your first query](#your-first-query). Already know your way around? Go to the [API explorer](https://api.soundtrack.io/v2/explore) or the [API reference](/api/graphql-reference).

Questions or suggestions? Drop us a line in our [public Slack channel](https://join.slack.com/t/soundtrack-api/shared_invite/enQtNjM5MzAwMzExNTI3LWIyZjQ3NjQ4MjU2NWJlM2YxZjk2YjZmNWNhMzdkMjNkNWI2ZTliYTg1Nzc2MGUwODQyODc3MzQ4MmY5NmNkZWE).

## Your first query

```shell
curl -XPOST https://api.soundtrack.io/v2 \
-H 'Authorization: Basic your_token' \
-H 'Content-Type: application/json' \
-d '{
  "query": "query NowPlaying($soundZone: ID!) { nowPlaying(soundZone: $soundZone) { track { title artists { name } } } }",
  "variables": {"soundZone": "sound_zone_id"},
  "operationName": "NowPlaying"
}'
```

> **Response**

```json
{
  "data": {
    "nowPlaying": {
      "track": {
        "title": "Branches",
        "artists": [
          {
            "name": "Fluida"
          }
        ]
      }
    }
  }
}
```

The Soundtrack API is a GraphQL API, so each request names the fields it wants and the response contains exactly those. This query asks what's playing in a zone, for example to show it on a screen in your store: the track's title and the names of its artists.

The zone's ID goes in `variables`: replace `sound_zone_id` with the ID of one of your zones. [Figuring out what you don't know](/api/basics#figuring-out-what-you-dont-know) shows how to find it.

There's a lot more you can fetch and control. The guide continues on these pages:

- [The basics](/api/basics): the endpoint, tokens and what a request is made of
- [Queries and mutations](/api/queries-and-mutations): reading data and making changes
- [Subscriptions](/api/subscriptions): updates as they happen, over a WebSocket
- [Errors and rate limits](/api/errors-and-rate-limits): what can go wrong, the rate limit, and when to retry
- [Advanced usage](/api/advanced): GraphQL clients, pagination, variables and fragments

To look up a type, query or mutation, browse the [API reference](/api/graphql-reference).

## Explore

To try the API, use [the API explorer](https://api.soundtrack.io/v2/explore). To read the schema without signing in, use the [API reference](/api/graphql-reference).

Add your `Authorization` header and the API explorer lets you write and run queries, with documentation and autocompletion.

Queries in the API explorer use live data and count toward your [rate limit](/api/errors-and-rate-limits#rate-limit).

## Terms of use

> Read and comply with our [API Terms of Use](https://www.soundtrack.io/legal/api-terms-of-use/)

By using the Soundtrack API, you accept our [API Terms of Use](https://www.soundtrack.io/legal/api-terms-of-use/). Make it clear to the people using your application that you built and maintain it. Using Soundtrack marketing material, other than artwork provided through the API, needs Soundtrack's written consent. For example, you can't use graphics from our products, such as buttons, to create a similar experience.

Licensing restrictions currently don't allow visitors to control playback. For example, you can build an application where your authorized staff change the music playing in a zone, but you can't offer the same controls to your visitors. Showing what's playing, such as the track name or URL, is fine, since that counts as non-interactive.
