# Find a track on other services

Source: https://docs.musicnerd.net/api-reference/lookups/track-links

Find a track on other services

## GET /api/trackLinks

Full OpenAPI specification: https://docs.musicnerd.net/spec/artist-lookups.json

## Authentication

This operation's specification permits a request without authentication.

[Authentication guide](https://docs.musicnerd.net/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Music Nerd API: artist lookups",
    "version": "1.0.0",
    "description": "Public lookups: an artist by Spotify ID or Instagram handle, an artist's X handle, artist search, track links, the contributor leaderboard and an artist's image. No credentials. Each endpoint answers in its own shape, with plain-text errors, not this API's `{ status }` envelope."
  },
  "servers": [
    {
      "url": "https://musicnerd-api.vercel.app",
      "description": "Production"
    },
    {
      "url": "https://musicnerd-api-staging.vercel.app",
      "description": "Staging (staging database)"
    }
  ],
  "paths": {
    "/api/trackLinks": {
      "get": {
        "summary": "Find a track on other services",
        "description": "Finds a song or album on Apple Music and Deezer by `title` and `artist` and returns the matching links.",
        "operationId": "trackLinks",
        "security": [],
        "parameters": [
          {
            "name": "title",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "The song or album title."
          },
          {
            "name": "artist",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "The artist's name."
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "album"
              ]
            },
            "description": "`album` searches albums; anything else searches songs."
          }
        ],
        "responses": {
          "200": {
            "description": "The matching links, none when neither provider has the record. `cached` is present only on an answer from memory.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "links"
                  ],
                  "properties": {
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TrackLink"
                      }
                    },
                    "cached": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "examples": {
                  "found": {
                    "value": {
                      "links": [
                        {
                          "service": "Apple Music",
                          "url": "https://music.apple.com/us/album/rush/1000000001?i=1000000002"
                        },
                        {
                          "service": "Deezer",
                          "url": "https://www.deezer.com/track/1000000003"
                        }
                      ]
                    }
                  },
                  "cached": {
                    "value": {
                      "links": [],
                      "cached": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`title` or `artist` is missing (`title and artist are required`) or longer than 200 characters (`title or artist too long`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorMessage"
                },
                "example": {
                  "error": "title and artist are required"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorMessage"
                },
                "example": {
                  "error": "Internal server error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "TrackLink": {
        "type": "object",
        "required": [
          "service",
          "url"
        ],
        "properties": {
          "service": {
            "type": "string",
            "enum": [
              "Apple Music",
              "Deezer"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ErrorMessage": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
```
