# Play a sound

`POST http://127.0.0.1:19470/v1/sounds/{padId}/play`

Plays a pad into the microphone, exactly like its shortcut in the app: a loop
starts or stops, any other sound starts again from the beginning. Works with
the voice changer on or off.

Authenticate with `Authorization: Bearer <API key>` (key from Settings > Developer in Voices AI Live).

## Path parameters

- `padId` (path · string, required)

## Responses

### 200: Playing

- `ok` (boolean, required)
- `error` (string): Present only when `ok` is `false`

```json
{
  "ok": true
}
```

### 400: The sound could not be played

- `ok` (boolean, required)
- `error` (string): Present only when `ok` is `false`

```json
{
  "ok": false,
  "error": "Choose a microphone output in the desktop app first."
}
```

### 401: Invalid or missing API key

- `error` (string, required): Error message

```json
{
  "error": "Invalid or missing API key"
}
```

### 403: The pad is on a board that needs a Live subscription

- `ok` (boolean, required)
- `error` (string): Present only when `ok` is `false`

### 404: No pad with this ID on your boards

- `ok` (boolean, required)
- `error` (string): Present only when `ok` is `false`

### 504: The desktop app did not finish the request in time

- `ok` (boolean, required)
- `error` (string): Present only when `ok` is `false`

```json
{
  "ok": false,
  "error": "The desktop app did not respond in time. Keep it open and signed in."
}
```

## Examples

```bash
curl -X POST http://127.0.0.1:19470/v1/sounds/pad_3f2a/play \
  -H "Authorization: Bearer $VOICES_AI_API_KEY"
```

```javascript
const res = await fetch('http://127.0.0.1:19470/v1/sounds/pad_3f2a/play', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.VOICES_AI_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os
import requests

res = requests.post(
    "http://127.0.0.1:19470/v1/sounds/pad_3f2a/play",
    headers={"Authorization": f"Bearer {os.environ['VOICES_AI_API_KEY']}"},
)
print(res.json())
```
