API reference

Analysis

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

Jump to an operation
POST/v1/analyze

Submit an analysis

Free and paid accountsUses tokens
  • API key required
  • Free and paid accounts
  • Uses tokens

Starts a full analysis of one audio file and returns 202 at once with a job_id. Poll GET /v1/analyze/{job_id} until status is final; the analysis itself normally takes seconds to a minute.

audio_url must be a public http or https URL, or the URL of a file in your own library. Files longer than 60 minutes are refused with 400 audio_too_long. Unreadable or unsupported files are refused with 400 unsupported_format or audio_processing_failed; a file that cannot be downloaded from the URL is refused with 404 audio_not_found. Your balance is checked before the job starts; if it cannot cover the file the call returns 402 insufficient_balance and nothing is charged. Supply features to name the measurements you care about; leave it out to get the standard set.

Cost. Charged when the analysis finishes: tokens per second of audio, at the rate for a full analysis. The submit response reports the amount in `expected_tokens`. A file longer than the maximum, or a balance too low to cover the file, is refused before anything starts.

curl -X POST "https://api.scarleta.ai/v1/analyze" \
  -H "Authorization: Bearer $SCARLETA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_url": "https://example.com/track-1.wav"
  }'

Request body

NameTypeRequiredDescription
audio_urlbodystringRequiredWhere to fetch the audio, at most 4096 characters. Must be public `http` or `https`, or a file in your own library. Allowed: 1 to 4096 characters.
featuresbodyarray<string>OptionalDotted feature ids to request, for example `spectral.centroid`. Ids that are not recognised are ignored and the standard set is used.
Response fields
FieldTypeDescription
job_idstringIdentifier to poll, cancel and read logs with.
status"IN_QUEUE" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "CANCELLED" | "TIMEOUT"`IN_QUEUE` when accepted.
messagestring
tenant_idstring | nullYour account identifier. Absent for free accounts.
audio_urlstringThe file being analyzed, with any credentials stripped from the URL.
workflow"direct-api"
created_atstringISO 8601 timestamp.
response_time_msintegerHow long accepting the job took, in milliseconds. Allowed: -9007199254740991 to 9007199254740991.
expected_durationnumberLength of the audio in seconds.
expected_tokensintegerTokens this analysis will cost when it finishes. Allowed: -9007199254740991 to 9007199254740991.
cache_hitbooleanTrue when the file had been read before and was reused.
Errors
StatusCodeDescription
400missing_audio_urlInvalid JSON, a missing `audio_url`, an unacceptable URL, or a file that cannot be read as audio (`error.details.supported_formats` lists the accepted formats).
401invalid_keyMissing, malformed, unknown or revoked API key.
402insufficient_balanceThe balance cannot cover this file. `error.details.required_tokens` says how much is needed.
403media_not_owned`audio_url` points at a library file owned by another account.
404audio_not_foundThe file at `audio_url` could not be downloaded.
429rate_limit_exceededOver the account request budget for the hour. Wait for the `Retry-After` header, then retry.
500analysis_service_errorThe analysis could not be started. Nothing was charged; retry.
503persistence_failedThe job could not be recorded. Nothing was charged; retry.
Example responses
{
  "data": {
    "job_id": "analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44",
    "status": "IN_QUEUE",
    "message": "Analysis job submitted. Use GET /v1/analyze/{job_id} to retrieve results.",
    "tenant_id": "8c1d0b52-3f6a-4e0d-9d7b-2a41c5e90f13",
    "audio_url": "https://example.com/track-1.wav",
    "workflow": "direct-api",
    "created_at": "2026-10-21T03:41:37.272Z",
    "response_time_ms": 610,
    "expected_duration": 5.2,
    "expected_tokens": 26,
    "cache_hit": false
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 202 Accepted. The job is queued. Carries an `X-Job-ID` header with the same `job_id`,.
  • 400 Invalid JSON, a missing `audio_url`, an unacceptable URL, or a file that cannot be read as audio (`error.details.supported_formats` lists the accepted formats).
  • 401 Missing, malformed, unknown or revoked API key.
  • 402 The balance cannot cover this file. `error.details.required_tokens` says how much is needed.
  • 403 `audio_url` points at a library file owned by another account.
  • 404 The file at `audio_url` could not be downloaded.
  • 429 Over the account request budget for the hour. Wait for the `Retry-After` header, then retry.
  • 500 The analysis could not be started. Nothing was charged; retry.
  • 503 The job could not be recorded. Nothing was charged; retry.

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.

Cost. Charged when the analysis finishes: tokens per second of audio, at the rate for a full analysis. The submit response reports the amount in `expected_tokens`. A file longer than the maximum, or a balance too low to cover the file, is refused before anything starts.

Other error codes this operation can return: analysis_failed, audio_processing_failed, audio_too_long, auth_unavailable, configuration_error, invalid_audio_duration, invalid_audio_url, invalid_auth_format, invalid_json, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, service_unavailable, unauthorized, unsupported_format.

GET/v1/analyze/{job_id}

Get an analysis

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

Returns the state of one analysis job and, once status is COMPLETED, its results. Poll this route every few seconds until status is FAILED, CANCELLED or TIMEOUT, or COMPLETED with results present. You can only read your own jobs; any other job id returns 404 job_not_found. For a few seconds after status first reads COMPLETED, results can still be null: keep polling until it is an object. results is a JSON object whose keys depend on the analysis and can grow over time: read the keys you need and ignore the rest.

Cost. Free of charge.

JOB_ID="YOUR_JOB_ID"
curl "https://api.scarleta.ai/v1/analyze/$JOB_ID" \
  -H "Authorization: Bearer $SCARLETA_API_KEY"

Parameters

NameTypeRequiredDescription
job_idpathstringRequiredThe `job_id` returned when the analysis was submitted, for example `analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44`. Allowed: at least 1 character.
Response fields
FieldTypeDescription
job_idstring
status"IN_QUEUE" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "CANCELLED" | "TIMEOUT"
workflowstringHow the job was started; `direct-api` for jobs created by `POST /v1/analyze`.
audio_urlstringThe analyzed file. A library file comes back as a short-lived signed link.
featuresarray<string>The feature ids you asked for; empty when you took the standard set.
resultsobject | nullThe measurements, or null until the job completes.
erroranyWhy the job failed, or null.
created_atstringISO 8601 timestamp.
completed_atstring | nullISO 8601 timestamp, or null while the job runs.
Errors
StatusCodeDescription
400invalid_job_id`job_id` has characters outside letters, digits and `_ . : -`, or is too long.
401invalid_keyMissing, malformed, unknown or revoked API key.
404job_not_foundNo job with this id exists for your account.
429rate_limit_exceededOver the account request budget for the hour. Wait for the `Retry-After` header, then retry.
500retrieval_failedThe job could not be read. Retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "job_id": "analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44",
    "status": "COMPLETED",
    "workflow": "direct-api",
    "audio_url": "https://example.com/track-1.wav",
    "features": [],
    "results": {
      "success": true,
      "summary": {
        "duration_seconds": 5,
        "dominant_key": "A",
        "rms_energy": 0.856
      }
    },
    "error": null,
    "created_at": "2026-10-21T03:41:37.272Z",
    "completed_at": "2026-10-21T03:41:56.630Z"
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 The job exists. `results` is null until `status` is `COMPLETED`.
  • 400 `job_id` has characters outside letters, digits and `_ . : -`, or is too long.
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 No job with this id exists for your account.
  • 429 Over the account request budget for the hour. Wait for the `Retry-After` header, then retry.
  • 500 The job could not be read. 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: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, missing_job_id, rate_limit_unavailable, unauthorized.

POST/v1/analyze/{job_id}/cancel

Cancel an analysis

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

Stops an analysis that has not finished and marks it CANCELLED. The call is idempotent: a job that is already final is left alone and its current status is returned, so a second cancel is not an error. A job cancelled before it finishes is not charged.

Cost. Free of charge. A cancelled job is not charged.

JOB_ID="YOUR_JOB_ID"
curl -X POST "https://api.scarleta.ai/v1/analyze/$JOB_ID/cancel" \
  -H "Authorization: Bearer $SCARLETA_API_KEY"

Parameters

NameTypeRequiredDescription
job_idpathstringRequiredThe `job_id` returned when the analysis was submitted, for example `analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44`. Allowed: at least 1 character.
Response fields
FieldTypeDescription
job_idstring
status"IN_QUEUE" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "CANCELLED" | "TIMEOUT"`CANCELLED` when this call stopped the job; otherwise the final state the job was already in.
Errors
StatusCodeDescription
400invalid_job_id`job_id` has characters outside letters, digits and `_ . : -`, or is too long.
401invalid_keyMissing, malformed, unknown or revoked API key.
404job_not_foundNo job with this id exists for your account.
429rate_limit_exceededOver the account request budget for the hour. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "job_id": "analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44",
    "status": "CANCELLED"
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 Success
  • 400 `job_id` has characters outside letters, digits and `_ . : -`, or is too long.
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 No job with this id exists for your account.
  • 429 Over the account request budget for the hour. 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: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, missing_job_id, rate_limit_unavailable, unauthorized.

GET/v1/analyze/{job_id}/logs

Get the logs of an analysis

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

Returns the execution log entries recorded for one of your jobs, oldest first, at most 200 entries. A job that has not started a step, or an analysis submitted with POST /v1/analyze, can have no entries: logs is then an empty array. Use the logs to diagnose a failed job.

Cost. Free of charge.

JOB_ID="YOUR_JOB_ID"
curl "https://api.scarleta.ai/v1/analyze/$JOB_ID/logs" \
  -H "Authorization: Bearer $SCARLETA_API_KEY"

Parameters

NameTypeRequiredDescription
job_idpathstringRequiredThe `job_id` returned when the analysis was submitted, for example `analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44`. Allowed: at least 1 character.
Response fields
FieldTypeDescription
job_idstring
status"IN_QUEUE" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "CANCELLED" | "TIMEOUT"
log_countintegerEntries in `logs`. Allowed: -9007199254740991 to 9007199254740991.
logsarray<object>
logs[].job_idstring
logs[].tool_namestring | nullName of the step that produced the entry.
logs[].worker_idstring | nullOpaque identifier of the machine that ran the step.
logs[].successboolean | nullWhether the step succeeded.
logs[].total_time_msnumber | nullHow long the step took, in milliseconds.
logs[].error_messagestring | nullWhy the step failed, when it did.
logs[].stdout_tailstring | nullThe last lines the step printed.
logs[].created_atstring | number | nullWhen the entry was recorded.
Errors
StatusCodeDescription
400invalid_job_id`job_id` has characters outside letters, digits and `_ . : -`, or is too long.
401invalid_keyMissing, malformed, unknown or revoked API key.
404job_not_foundNo job with this id exists for your account.
429rate_limit_exceededOver the account request budget for the hour. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "job_id": "analysis_8f3c2a41-6d57-4b1e-9a02-5c7e1d0b9a44",
    "status": "COMPLETED",
    "log_count": 0,
    "logs": []
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 Success
  • 400 `job_id` has characters outside letters, digits and `_ . : -`, or is too long.
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 No job with this id exists for your account.
  • 429 Over the account request budget for the hour. 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: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, missing_job_id, rate_limit_unavailable, unauthorized.