> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.algorhythm.app/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.algorhythm.app/_mcp/server.

# Index sources

POST https://api.algorhythm.app/v1/sources/index
Content-Type: application/json

Queue one or more TikTok sounds and/or hashtags for indexing. Each source costs 1 credit. Indexing crawls posts, identifies creators, and computes trend and audience analytics. Use the status and download endpoints to retrieve results once complete.

Reference: https://docs.algorhythm.app/api-reference/sources/index-sources-v-1-sources-index-post

## Authentication

- `X-API-Key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an IndexRequest.

- `sound_ids` (list of string, optional) — TikTok sound IDs to index.
- `hashtags` (list of string, optional) — TikTok hashtags to index (without the `#`).
- `options` (map from string to any, optional) — Optional indexing tuning. Supported keys: `post_count` (int), `force_refresh` (bool).
- `webhook_url` (string, optional, nullable) — Optional webhook to notify when indexing completes.

## Response

### 200

Successful Response

- `sources` (list of IndexedSource, required)

## Errors

### 402 Payment Required Error

Not enough credits to index the requested sources.

- `any`

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### IndexedSource

- `type` (string, required) — Source type: `sound` or `hashtag`.
- `id` (string, required) — The sound ID or hashtag indexed.
- `task_id` (string, optional, nullable) — Background task ID for the indexing job.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "sound_ids": [
    "snd_8f3a2b1c",
    "snd_4d7e9f0a"
  ],
  "hashtags": [
    "ambient",
    "nature",
    "relaxing"
  ],
  "options": {
    "priority": "high",
    "index_type": "full",
    "retry_on_failure": true
  },
  "webhook_url": "https://example.com/webhook/index-callback"
}
```

**Response**

```json
{
  "sources": [
    {
      "type": "sound",
      "id": "snd_8f3a2b1c",
      "task_id": "7c1f9e2a-4b88-4d3f-9a02-21cb5b8a4f12"
    },
    {
      "type": "sound",
      "id": "snd_4d7e9f0a",
      "task_id": "3a09c12b-4e2d-4a91-bc77-9e2b14f8a1c5"
    },
    {
      "type": "hashtag",
      "id": "ambient",
      "task_id": "92ef4b1d-87a3-4d22-a51e-7b6cf2d9018e"
    },
    {
      "type": "hashtag",
      "id": "nature",
      "task_id": "14c0d8a2-bef1-44a3-9d52-c107fa42e6b8"
    },
    {
      "type": "hashtag",
      "id": "relaxing",
      "task_id": "61b8a9d4-f3e7-4f9a-9d1b-72e3c145ab90"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.algorhythm.app/v1/sources/index"

payload = {
    "sound_ids": ["snd_8f3a2b1c", "snd_4d7e9f0a"],
    "hashtags": ["ambient", "nature", "relaxing"],
    "options": {
        "priority": "high",
        "index_type": "full",
        "retry_on_failure": True
    },
    "webhook_url": "https://example.com/webhook/index-callback"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.algorhythm.app/v1/sources/index';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"sound_ids":["snd_8f3a2b1c","snd_4d7e9f0a"],"hashtags":["ambient","nature","relaxing"],"options":{"priority":"high","index_type":"full","retry_on_failure":true},"webhook_url":"https://example.com/webhook/index-callback"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.algorhythm.app/v1/sources/index"

	payload := strings.NewReader("{\n  \"sound_ids\": [\n    \"snd_8f3a2b1c\",\n    \"snd_4d7e9f0a\"\n  ],\n  \"hashtags\": [\n    \"ambient\",\n    \"nature\",\n    \"relaxing\"\n  ],\n  \"options\": {\n    \"priority\": \"high\",\n    \"index_type\": \"full\",\n    \"retry_on_failure\": true\n  },\n  \"webhook_url\": \"https://example.com/webhook/index-callback\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.algorhythm.app/v1/sources/index")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sound_ids\": [\n    \"snd_8f3a2b1c\",\n    \"snd_4d7e9f0a\"\n  ],\n  \"hashtags\": [\n    \"ambient\",\n    \"nature\",\n    \"relaxing\"\n  ],\n  \"options\": {\n    \"priority\": \"high\",\n    \"index_type\": \"full\",\n    \"retry_on_failure\": true\n  },\n  \"webhook_url\": \"https://example.com/webhook/index-callback\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.algorhythm.app/v1/sources/index")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sound_ids\": [\n    \"snd_8f3a2b1c\",\n    \"snd_4d7e9f0a\"\n  ],\n  \"hashtags\": [\n    \"ambient\",\n    \"nature\",\n    \"relaxing\"\n  ],\n  \"options\": {\n    \"priority\": \"high\",\n    \"index_type\": \"full\",\n    \"retry_on_failure\": true\n  },\n  \"webhook_url\": \"https://example.com/webhook/index-callback\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.algorhythm.app/v1/sources/index', [
  'body' => '{
  "sound_ids": [
    "snd_8f3a2b1c",
    "snd_4d7e9f0a"
  ],
  "hashtags": [
    "ambient",
    "nature",
    "relaxing"
  ],
  "options": {
    "priority": "high",
    "index_type": "full",
    "retry_on_failure": true
  },
  "webhook_url": "https://example.com/webhook/index-callback"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.algorhythm.app/v1/sources/index");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"sound_ids\": [\n    \"snd_8f3a2b1c\",\n    \"snd_4d7e9f0a\"\n  ],\n  \"hashtags\": [\n    \"ambient\",\n    \"nature\",\n    \"relaxing\"\n  ],\n  \"options\": {\n    \"priority\": \"high\",\n    \"index_type\": \"full\",\n    \"retry_on_failure\": true\n  },\n  \"webhook_url\": \"https://example.com/webhook/index-callback\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "sound_ids": ["snd_8f3a2b1c", "snd_4d7e9f0a"],
  "hashtags": ["ambient", "nature", "relaxing"],
  "options": [
    "priority": "high",
    "index_type": "full",
    "retry_on_failure": true
  ],
  "webhook_url": "https://example.com/webhook/index-callback"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.algorhythm.app/v1/sources/index")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```