API reference

Similar sounds

2 operations. Base URL https://api.scarleta.ai. Select an operation to see its parameters, samples and errors.

Jump to an operation
POST/v1/audio/library/similar

Find files that sound like a file or a link

Free and paid accounts
  • API key required
  • Free and paid accounts
  • No token cost

Same search as the GET route, with the reference given in the body: send exactly one of audio_id or reference_url (the address of one of your files, as in an audio_url). The reference file needs a sound fingerprint (the embedding analysis). A file you own without one is 409 embedding_missing; a file that does not exist or is not yours is 404 audio_not_found. A reference_url that is not one of your files is 404 audio_not_found. limit is a whole number from 1 to 100 (default 20); min_score is a number from -1 to 1 (default -1, which keeps everything). The search compares only your own files and is exact, so on a large library it can take a moment. Any field the route does not know is 400 invalid_config; neither or both references is 400 invalid_reference.

Cost. Free of charge. The embedding analysis that creates a fingerprint is billed when you run it.

curl -X POST "https://api.scarleta.ai/v1/audio/library/similar" \
  -H "Authorization: Bearer $SCARLETA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_id": "audio_3f9c1a7d2b60",
    "limit": 10,
    "min_score": 0.5
  }'

Request body

NameTypeRequiredDescription
audio_idbodystringOptionalThe `audio_id` or file id of the reference file. Send this or `reference_url`.
reference_urlbodystringOptionalThe address of the reference file in your library. Send this or `audio_id`.
limitbodyintegerOptionalHow many results to return, 1 to 100. Defaults to 20.
min_scorebodynumberOptionalLeave out files scoring below this, -1 to 1. Defaults to -1.
Response fields
FieldTypeDescription
reference_audio_idstringThe file the search compared against.
embedding_modelstringName of the fingerprint kind that was compared. Only files with a fingerprint of the same kind can match.
resultsarray<object>Your most similar files, best first. The reference itself is never listed.
results[].audio_idstringRegistry identifier of the similar file; it starts with `audio_`.
results[].original_filenamestringName the file was uploaded under.
results[].display_namestring | nullName you gave the file, or null.
results[].similarity_scorenumberHow alike the sound is, from -1 to 1, to four decimals. Higher is closer.
results[].bpmnumber | nullTempo of the file, or null when it has none.
results[].key_labelstring | nullMusical key of the file, for example `A minor`, or null.
results[].analyzed_categoriesarray<string>Analysis categories this file has results for.
countintegerEntries in `results`. Allowed: -9007199254740991 to 9007199254740991.
notestringA fixed sentence on what similarity means.
Errors
StatusCodeDescription
400invalid_referenceThe body is not valid JSON (`invalid_json`), has an unknown field (`invalid_config`), does not name exactly one reference (`invalid_reference`), or `limit` / `min_score` is not allowed (`invalid_limit`, `invalid_min_score`).
401invalid_keyMissing, malformed, unknown or revoked API key.
404audio_not_foundThe reference file does not exist in your library.
409embedding_missingThe reference file has no sound fingerprint yet.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "reference_audio_id": "audio_3f9c1a7d2b60",
    "embedding_model": "fingerprint-6144",
    "results": [
      {
        "audio_id": "audio_a81e5c40d7f2",
        "original_filename": "demo-mix-2.wav",
        "display_name": null,
        "similarity_score": 0.9312,
        "bpm": 119.8,
        "key_label": "A minor",
        "analyzed_categories": [
          "rhythm",
          "embedding"
        ]
      }
    ],
    "count": 1,
    "note": "Similarity is acoustic character (timbre/texture), not structural or temporal match."
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 The closest files, best first.
  • 400 The body is not valid JSON (`invalid_json`), has an unknown field (`invalid_config`), does not name exactly one reference (`invalid_reference`), or `limit` / `min_score` is not allowed (`invalid_limit`, `invalid_min_score`).
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 The reference file does not exist in your library.
  • 409 The reference file has no sound fingerprint yet.
  • 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
  • 503 Temporary platform condition; retry shortly.

Try it

Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.

Other error codes this operation can return: db_unavailable, invalid_auth_format, invalid_config, invalid_json, invalid_key_format, invalid_limit, invalid_min_score, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.

GET/v1/audio/library/similar/{audio_id}

Find files that sound like one of yours

Free and paid accounts
  • API key required
  • Free and paid accounts
  • No token cost

Returns the files in your library whose sound is closest to the file named in the path (audio_id or the file id). The reference file needs a sound fingerprint (the embedding analysis). A file you own without one is 409 embedding_missing; a file that does not exist or is not yours is 404 audio_not_found. limit is a whole number from 1 to 100 (default 20); min_score is a number from -1 to 1 (default -1, which keeps everything). The search compares only your own files and is exact, so on a large library it can take a moment. A bad limit is 400 invalid_limit, a bad min_score 400 invalid_min_score. If the database is briefly unavailable the route answers 503 db_unavailable; retry after a short wait.

Cost. Free of charge. The embedding analysis that creates a fingerprint is billed when you run it.

AUDIO_ID="YOUR_AUDIO_ID"
curl "https://api.scarleta.ai/v1/audio/library/similar/$AUDIO_ID" \
  -H "Authorization: Bearer $SCARLETA_API_KEY"

Parameters

NameTypeRequiredDescription
audio_idpathstringRequiredThe `audio_id` or file id of the reference file.
limitqueryintegerOptionalHow many results to return, 1 to 100. Defaults to 20.
min_scorequerynumberOptionalLeave out files scoring below this, -1 to 1. Defaults to -1.
Response fields
FieldTypeDescription
reference_audio_idstringThe file the search compared against.
embedding_modelstringName of the fingerprint kind that was compared. Only files with a fingerprint of the same kind can match.
resultsarray<object>Your most similar files, best first. The reference itself is never listed.
results[].audio_idstringRegistry identifier of the similar file; it starts with `audio_`.
results[].original_filenamestringName the file was uploaded under.
results[].display_namestring | nullName you gave the file, or null.
results[].similarity_scorenumberHow alike the sound is, from -1 to 1, to four decimals. Higher is closer.
results[].bpmnumber | nullTempo of the file, or null when it has none.
results[].key_labelstring | nullMusical key of the file, for example `A minor`, or null.
results[].analyzed_categoriesarray<string>Analysis categories this file has results for.
countintegerEntries in `results`. Allowed: -9007199254740991 to 9007199254740991.
notestringA fixed sentence on what similarity means.
Errors
StatusCodeDescription
400invalid_limit`limit` or `min_score` is not allowed (`invalid_limit`, `invalid_min_score`).
401invalid_keyMissing, malformed, unknown or revoked API key.
404audio_not_foundThe reference file does not exist in your library.
409embedding_missingThe reference file has no sound fingerprint yet.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "reference_audio_id": "audio_3f9c1a7d2b60",
    "embedding_model": "fingerprint-6144",
    "results": [
      {
        "audio_id": "audio_a81e5c40d7f2",
        "original_filename": "demo-mix-2.wav",
        "display_name": null,
        "similarity_score": 0.9312,
        "bpm": 119.8,
        "key_label": "A minor",
        "analyzed_categories": [
          "rhythm",
          "embedding"
        ]
      }
    ],
    "count": 1,
    "note": "Similarity is acoustic character (timbre/texture), not structural or temporal match."
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 The closest files, best first. The list is empty when no other file has a fingerprint of the same kind.
  • 400 `limit` or `min_score` is not allowed (`invalid_limit`, `invalid_min_score`).
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 The reference file does not exist in your library.
  • 409 The reference file has no sound fingerprint yet.
  • 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
  • 503 Temporary platform condition; retry shortly.

Try it

Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.

Other error codes this operation can return: db_unavailable, invalid_auth_format, invalid_key_format, invalid_min_score, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.