Agent note

Agent notes: the standard recognition endpoint

Gotcha notes for AI agents writing a first AudD call: one short clip per request, URL vs file vs bytes, result: null on no match, opt-in metadata, the test token, the 10 MB cap, and errors by category.

view .md auddstandard endpointrecognizeagent

recognize is the default API method, at POST https://api.audd.io/. It’s for the usual music recognition that works like Shazam: you send a short clip, and we send back the song. These are the things to get right in a first call, so read them before you write the request.

curl https://api.audd.io/ \
  -F api_token=your-api-token \
  -F url='https://audd.tech/example.mp3'
from audd import AudD

audd = AudD()  # reads the token from AUDD_API_TOKEN
result = audd.recognize("https://audd.tech/example.mp3")
if result is None:
    print("No match")
else:
    print(result.artist, "-", result.title, result.song_link)

1. One request is one short clip and one song

The standard endpoint analyzes up to the first 12 seconds of the audio and returns the top match, so send the part with the music. If you need to recognize a full-length track, a video, a podcast, a DJ set or any file with more than one song, use the enterprise endpoint instead. We have a separate endpoint that handles large files: you can send hours-long or even days-long audio to it. The requests are counted as 1 request per 12 seconds of audio, so always set limit there:

curl https://enterprise.audd.io/ \
  -F api_token=your-api-token \
  -F url='https://audd.tech/example.mp3' \
  -F limit=1

The enterprise agent notes explain its response, which is a list of matches instead of one result.

2. Send a URL if you have one, a file if you don’t

There are three ways to send files to our API:

  • Provide an HTTP URL for the file in the url parameter. Our server will download the file and identify the music. If the file is available by URL, it’s the easiest way to send it.
  • Post the file using multipart/form-data, in the file parameter. We recommend sending a file this way when the file is not available by a URL (for example, if it’s recorded locally).
  • Send a base64 encoded file in the audio parameter. We discourage the use of this parameter and have very limited support for it.
curl https://api.audd.io/ \
  -F api_token=your-api-token \
  -F [email protected]

The SDKs will pick the right field for you:

result = audd.recognize("clip.mp3")  # a URL, a file path, a file object or bytes

Please call https://, not http://. The http:// requests get redirected, and we don’t receive any data from you when your code follows the redirect: you’ll get error 700.

3. status: "success" with result: null means no match

All the responses contain the status field that equals either "success" if the request was successfully processed or "error" if there’s been an error. If the server has successfully processed the request, but there are no matches, the result field is null. So "success" doesn’t mean that a song was found: check result separately, and treat null as a normal answer. The SDKs return None (Python) or null (Node.js) from recognize. Never guess a song.

{"status": "success", "result": null}

If there are matches, result always contains artist, title, album, release_date, label, timecode, and song_link. And just in case: timecode is the time in the recognized song when the fragment you sent is played, not a position in your clip. The result fields reference has the rest.

4. Errors come back with HTTP 200, so check status

We have about 40 different error codes. The API returns the errors with an explanation of what happened, and the HTTP status is still 200:

{"status": "error", "error": {"error_code": 900, "error_message": "..."}}

Check the status field, not the HTTP status. These are the categories of errors, from the error codes reference:

  • The token (900, 901, 903): check the api_token parameter. If you retry with the same token, you’ll get the same error.
  • Quota and subscription (902, 904, 905): no requests left, or the token can’t use this feature. Tell the user.
  • The request (600, 700 and others): a bad URL, or no file received. Fix the parameters.
  • The audio (300, 400, 500): the file can’t be fingerprinted, is too large, or isn’t audio. Fix the file.
  • The server (19, 100): an internal or unknown error. Contact us if it happens again.

In the SDKs, you’ll get a typed exception instead. Each typed exception contains the error_code and the message from the response:

from audd import (
    AudD,
    AudDAPIError,
    AudDAuthenticationError,
    AudDConnectionError,
    AudDInvalidAudioError,
    AudDQuotaError,
)

audd = AudD()
try:
    result = audd.recognize("https://audd.tech/example.mp3")
except AudDAuthenticationError:
    print("Check AUDD_API_TOKEN")
except AudDQuotaError:
    print("No requests left on this account")
except AudDInvalidAudioError as e:
    print("Fix the audio:", e.error_code, e.message)
except AudDAPIError as e:  # any other error the server returned
    print("AudD error", e.error_code, e.message)
except AudDConnectionError as e:
    print("Network problem, try again later:", e)

The SDKs will automatically retry the connection failures that happen before the upload is complete. You can retry the internal error 19 with a backoff, but the other errors will come back the same. Please note that a cancelled request might still consume requests.

5. Metadata blocks are opt-in, and each one adds latency

The return parameter is for comma-separated identifiers of the additional metadata you want to be returned: apple_music, spotify, deezer, musicbrainz. Each provider adds some latency, so ask only for the blocks you’ll use. song_link is always there on a match, without return.

result = audd.recognize(
    "https://audd.tech/example.mp3",
    return_metadata=["apple_music", "spotify"],
)
if result and result.apple_music:
    print(result.apple_music.url)

market is the country code for Apple Music, iTunes, and Spotify results (by default, us). Napster is no longer available: if you send napster, the response gets warning #51 and no Napster block.

Enterprise features such as ISRC and UPC codes and the match score are available on a Startup plan or higher, on request: email [email protected]. Without them, results come back without these fields.

In the Python SDK, fields outside the typed surface are in result.model_extra.

When a file you upload is over 10 MB

If the file you upload is too big, you’ll get error 400: the standard endpoint accepts files up to 10 MB. A file that our server downloads from the url parameter isn’t limited this way. If you need to recognize larger audio files, use the enterprise endpoint instead, with a limit. Or cut the part with the music into a short clip.

6. The test token is for one hello-world

api_token=test works only on the standard endpoint, with a limit of 10 requests per day, shared by everyone who uses it. It doesn’t work on the enterprise endpoint or for streams, and once the day’s limit is used up, you’ll get error 901. So don’t ship it in code. The user gets a token at dashboard.audd.io and keeps it in the AUDD_API_TOKEN environment variable, which the SDKs read when no token is passed. Never hard-code, print, log or commit the token, and don’t ask the user to paste it into the chat.

There are no rate limits on the standard endpoint. You can send requests in parallel, as many as you need. If you plan to send a large volume, please let us know in advance at [email protected].

7. Install the official SDK for the project’s language

LanguageInstall
Pythonpip install audd
Node.js / TypeScriptnpm install @audd/sdk
Gogo get github.com/AudDMusic/audd-go
Rustcargo add audd
PHPcomposer require audd/audd
.NET / C#dotnet add package AudD
JavaMaven Central io.audd:audd:1.5.19
Kotlinimplementation("io.audd:audd-kotlin:1.5.18")
Swift.package(url: "https://github.com/AudDMusic/audd-swift", from: "1.5.21")
C, C++CMake, see docs.audd.io/sdks

Every SDK wraps the same HTTP API. If you have a shell, you can also use the AudD CLI: audd recognize sends the same request.

8. If the user has no token

If the user doesn’t have a token, you can register with AudD yourself and pay for prepaid requests, without an account or an email. See Agent notes: prepaid requests without an AudD account. The agent endpoint takes the same parameters and returns the same response as this one. If the user has an AudD account and an MCP client, see the MCP server notes.


Related

Reading this as an AI agent? The raw Markdown is at agents/standard-recognition.md, and the full index is /resources/llms.txt.