# Cover Images | AudioDN Docs

> API endpoints for uploading and managing cover art for tracks and collections. Generate automatic color themes from artwork.

Source: https://audiodeliverynetwork.com/docs/api/covers/

---

# Cover Images

Generate upload URLs for collection and track cover images.

POST `/v1/collection/:collection_id/cover`

Generates an upload URL for a collection's cover image

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `collection_id` | uuid | Required | The ID of the collection (path parameter) |

#### Example Request

    

```
curl -X POST "https://api.audiodelivery.net/v1/collection/COLLECTION_ID/cover" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
const response = await fetch('https://api.audiodelivery.net/v1/collection/COLLECTION_ID/cover', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
```

```
import Foundation

func performRequest() async throws {
    var request = URLRequest(url: URL(string: "https://api.audiodelivery.net/v1/collection/COLLECTION_ID/cover")!)
    request.httpMethod = "POST"
    request.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
    let (data, _) = try await URLSession.shared.data(for: request)
    let json = try JSONSerialization.jsonObject(with: data) as! [String: Any]
    // use json
}
```

```
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.*

val client = OkHttpClient()

suspend fun performRequest(): String = withContext(Dispatchers.IO) {
    val request = Request.Builder()
        .url("https://api.audiodelivery.net/v1/collection/COLLECTION_ID/cover")
        .addHeader("Authorization", "Bearer YOUR_API_KEY")
        .build()
    val response = client.newCall(request).execute()
    response.body?.string() ?: error("Empty response body")
}
```

```
import 'dart:convert';
import 'package:http/http.dart' as http;

Future<Map<String, dynamic>> performRequest() async {
  final response = await http.post(
    Uri.parse('https://api.audiodelivery.net/v1/collection/COLLECTION_ID/cover'),
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
    },
  );
  if (response.statusCode < 200 || response.statusCode >= 300) {
    throw Exception('Request failed: ${response.statusCode}');
  }
  return jsonDecode(response.body) as Map<String, dynamic>;
}
```

#### Response

```
{
  "ok": true,
  "api_request_id": "uuid",
  "collection_id": "uuid",
  "collection": {
    "id": "uuid",
    "organization_id": "uuid",
    "title": "string",
    "organization_index": "string | null",
    "metadata": {},
    "theme": [],
    "player_color": "string | null",
    "player_color_light": "string | null",
    "player_color_dark": "string | null",
    "player_subtitle": "string | null",
    "is_cover_overridable": true,
    "is_theme_overridable": true
  },
  "collection_cover_upload": {
    "method": "POST",
    "upload_url": "string",
    "ttl": 3600,
    "expires_at": "string"
  }
}
```

After you upload the image to the returned `upload_url`, it will be processed for colors and applied to the collection (including `theme` and `player_color`).

POST `/v1/track/:track_id/cover`

Generates an upload URL for a track's cover image

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `track_id` | uuid | Required | The ID of the track (path parameter) |

#### Example Request

    

```
curl -X POST "https://api.audiodelivery.net/v1/track/TRACK_ID/cover" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
const response = await fetch('https://api.audiodelivery.net/v1/track/TRACK_ID/cover', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
```

```
import Foundation

func performRequest() async throws {
    var request = URLRequest(url: URL(string: "https://api.audiodelivery.net/v1/track/TRACK_ID/cover")!)
    request.httpMethod = "POST"
    request.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
    let (data, _) = try await URLSession.shared.data(for: request)
    let json = try JSONSerialization.jsonObject(with: data) as! [String: Any]
    // use json
}
```

```
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.*

val client = OkHttpClient()

suspend fun performRequest(): String = withContext(Dispatchers.IO) {
    val request = Request.Builder()
        .url("https://api.audiodelivery.net/v1/track/TRACK_ID/cover")
        .addHeader("Authorization", "Bearer YOUR_API_KEY")
        .build()
    val response = client.newCall(request).execute()
    response.body?.string() ?: error("Empty response body")
}
```

```
import 'dart:convert';
import 'package:http/http.dart' as http;

Future<Map<String, dynamic>> performRequest() async {
  final response = await http.post(
    Uri.parse('https://api.audiodelivery.net/v1/track/TRACK_ID/cover'),
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
    },
  );
  if (response.statusCode < 200 || response.statusCode >= 300) {
    throw Exception('Request failed: ${response.statusCode}');
  }
  return jsonDecode(response.body) as Map<String, dynamic>;
}
```

#### Response

```
{
  "ok": true,
  "api_request_id": "uuid",
  "track_id": "uuid",
  "track": {
    "id": "uuid",
    "organization_id": "uuid",
    "collection_id": "uuid",
    "index": "string",
    "duration": 0,
    "file_name": "string",
    "order": 0,
    "metadata": {},
    "player_title": "string | null",
    "player_subtitle": "string | null",
    "player_color": "string | null",
    "player_color_light": "string | null",
    "player_color_dark": "string | null",
    "theme": [],
    "track_status_id": "string"
  },
  "track_cover_upload": {
    "method": "POST",
    "upload_url": "string",
    "ttl": 3600,
    "expires_at": "string"
  }
}
```

After you upload the image to the returned `upload_url`, it will be processed for colors and applied to the track (including `theme` and `player_color`).
