{
  "openapi": "3.1.0",
  "info": {
    "title": "OnChain Music Agent API",
    "description": "A music licensing API for AI agents. Search 8,700+ independently owned, fully cleared songs plus partner catalogs by genre, mood, BPM, and other attributes, then license tracks autonomously with USDC payments on Base using the x402 protocol.\n\n## Licensing flow\n1. Search with `/catalog/search` or `/ai-search`.\n2. Optionally get details with `/catalog/tracks/{id}`.\n3. Ask whether the license is personal (non-commercial) or business:\n   - Personal: `POST /license/{track_id}/social_media` ($10.00) or `/all_digital` ($35.00).\n   - Business (branded social media, commercials, film, television, trailers, and more): `GET /license/options?track_id=...`, then `POST /license/quote`.\n4. Send `paying_wallet` (required) and, optionally, licensee details. You receive `402 Payment Required` with a `payment_id` like `OCM-Q000123`, the exact amount, and a `terms_url`.\n5. Send exactly that amount of USDC on Base from `paying_wallet` to the receiving address before `expires_at` (15 minutes).\n6. Poll `/license/verify/{payment_id}` until `status` is `license_issued`.\n7. Receive the license number, download links, the license agreement PDF, and a signed license document. Links expire after 30 days, so save the files.\n\nInitiating a license accepts the license agreement at `terms_url`. Prices are in USD and paid as the same amount of USDC. Only tracks whose artists opted in to AI agent licensing can be licensed through this API.\n\n## Payment\n- Chain: Base (chain_id 8453)\n- Token: USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)\n- Protocol: x402\n- No memo or calldata. Payments are matched by the sending wallet and the exact amount.",
    "version": "2.0.0",
    "contact": {
      "name": "OnChain Music Licensing",
      "url": "https://onchainmusic.com/contact",
      "email": "licensing@onchainmusic.com"
    }
  },
  "externalDocs": {
    "description": "OnChain Music Agent API Documentation",
    "url": "https://onchainmusic.com/api-docs"
  },
  "servers": [
    {
      "url": "https://onchainmusic.com/api/v1/agent",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Catalog",
      "description": "Search and browse the music catalog"
    },
    {
      "name": "Licensing",
      "description": "License options, purchases, and verification"
    }
  ],
  "paths": {
    "/catalog/search": {
      "get": {
        "tags": [
          "Catalog"
        ],
        "summary": "Search the music catalog",
        "operationId": "catalogSearch",
        "description": "Search 8,700+ songs plus partner catalogs by musical attributes. Returns up to per_page tracks and a results_url that opens every match on onchainmusic.com.",
        "parameters": [
          {
            "name": "description",
            "in": "query",
            "description": "PRIMARY search field. Pass style, mood, energy, instrumentation, or use-case words. Each word is searched individually across multiple fields. Example: epic orchestral trailer",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "genre",
            "in": "query",
            "description": "Genre (for example Rock, Electronica, Hip-Hop).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "subgenre",
            "in": "query",
            "description": "Subgenre (for example Indie, Deep House).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "additional",
            "in": "query",
            "description": "Additional genre categories.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "mood",
            "in": "query",
            "description": "Deprecated. Pass mood words in description instead.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "tempo",
            "in": "query",
            "description": "Tempo label (for example Medium Fast (130 - 150 BPM)).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "bpm_min",
            "in": "query",
            "description": "Minimum BPM.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 300
            }
          },
          {
            "name": "bpm_max",
            "in": "query",
            "description": "Maximum BPM.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 300
            }
          },
          {
            "name": "key",
            "in": "query",
            "description": "Musical key (for example C Minor, G Maj).",
            "schema": {
              "type": "string",
              "maxLength": 20
            }
          },
          {
            "name": "instrumental",
            "in": "query",
            "description": "Yes = instrumental only, No = has vocals.",
            "schema": {
              "type": "string",
              "enum": [
                "Yes",
                "No"
              ]
            }
          },
          {
            "name": "keywords",
            "in": "query",
            "description": "Keyword search.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "license_type",
            "in": "query",
            "description": "Show pricing for one standard license type only.",
            "schema": {
              "type": "string",
              "enum": [
                "social_media",
                "all_digital"
              ]
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Results per page (default 20, max 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog search results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSearchResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (60 requests per minute)."
          }
        }
      }
    },
    "/ai-search": {
      "post": {
        "tags": [
          "Catalog"
        ],
        "summary": "Natural language music search",
        "operationId": "aiSearch",
        "description": "Send a plain English phrase. The API translates it into structured search parameters and returns the same response as /catalog/search plus an ai object showing the translation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "phrase"
                ],
                "properties": {
                  "phrase": {
                    "type": "string",
                    "description": "Plain English music description, passed as the user wrote it.",
                    "example": "I need an upbeat indie rock track for a TV commercial"
                  },
                  "per_page": {
                    "type": "integer",
                    "description": "Results per page (default 10).",
                    "default": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search results with AI translation.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CatalogSearchResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ai": {
                          "type": "object",
                          "properties": {
                            "original_phrase": {
                              "type": "string"
                            },
                            "translated_params": {
                              "type": "object"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/catalog/tracks/{id}": {
      "get": {
        "tags": [
          "Catalog"
        ],
        "summary": "Get a single track",
        "operationId": "catalogTrack",
        "description": "Full metadata for one track, with standard license pricing and available download formats.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks.",
            "schema": {
              "type": "string",
              "pattern": "^(partner_)?[0-9]+$",
              "example": "417",
              "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Track detail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackDetailResponse"
                }
              }
            }
          },
          "404": {
            "description": "Track not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/license/options": {
      "get": {
        "tags": [
          "Licensing"
        ],
        "summary": "List license options",
        "operationId": "licenseOptions",
        "description": "License options with prices. \"personal\" lists the non-commercial standard licenses (use their license_type with POST /license/{track_id}/{license_type}). \"business\" is the rate card: medium, category, territory, and term, with prices by tier (use with POST /license/quote). With track_id, also says whether the track can be licensed and adds that track's prices.",
        "parameters": [
          {
            "name": "track_id",
            "in": "query",
            "required": false,
            "description": "Optional. Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks.",
            "schema": {
              "type": "string",
              "pattern": "^(partner_)?[0-9]+$",
              "example": "417",
              "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rate card.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenseOptionsResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (10 requests per minute)."
          }
        }
      }
    },
    "/license/{track_id}/{license_type}": {
      "post": {
        "tags": [
          "Licensing"
        ],
        "summary": "Personal license",
        "operationId": "licenseInitiate",
        "description": "Start a personal (non-commercial) license: social_media ($10.00, personal videos on social platforms) or all_digital ($35.00, non-commercial use on websites, podcasts, streaming, and online video). Both are perpetual, worldwide, and non-exclusive. Returns 402 with payment instructions.",
        "parameters": [
          {
            "name": "track_id",
            "in": "path",
            "required": true,
            "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks.",
            "schema": {
              "type": "string",
              "pattern": "^(partner_)?[0-9]+$",
              "example": "417",
              "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks."
            }
          },
          {
            "name": "license_type",
            "in": "path",
            "required": true,
            "description": "Personal license type.",
            "schema": {
              "type": "string",
              "enum": [
                "social_media",
                "all_digital"
              ]
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Pass gpt to receive 200 instead of 402, for clients that cannot read 402 responses (for example ChatGPT GPT Actions).",
            "schema": {
              "type": "string",
              "enum": [
                "gpt"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LicenseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment instructions (only with mode=gpt). Send USDC as described, then poll verify_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment required. x402 payment challenge with the exact amount, receiving wallet, and verify_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredResponse"
                }
              }
            }
          },
          "202": {
            "description": "The clearance answers need review by the licensing team before payment. No payment is requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewRequiredResponse"
                }
              }
            }
          },
          "404": {
            "description": "Track not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "This track is licensed by custom quote only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactForQuoteResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation error, or the track or option is not available for licensing by AI agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (10 requests per minute)."
          }
        }
      }
    },
    "/license/quote": {
      "post": {
        "tags": [
          "Licensing"
        ],
        "summary": "Business license from the rate card",
        "operationId": "licenseQuote",
        "description": "Start a license for any rate card option from GET /license/options (\"business\"). The price depends on the track's tier. Returns 402 with payment instructions.",
        "parameters": [
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Pass gpt to receive 200 instead of 402, for clients that cannot read 402 responses (for example ChatGPT GPT Actions).",
            "schema": {
              "type": "string",
              "enum": [
                "gpt"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LicenseQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment instructions (only with mode=gpt). Send USDC as described, then poll verify_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment required. x402 payment challenge with the exact amount, receiving wallet, and verify_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredResponse"
                }
              }
            }
          },
          "202": {
            "description": "The clearance answers need review by the licensing team before payment. No payment is requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewRequiredResponse"
                }
              }
            }
          },
          "404": {
            "description": "Track not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "This track is licensed by custom quote only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactForQuoteResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation error, or the track or option is not available for licensing by AI agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (10 requests per minute)."
          }
        }
      }
    },
    "/license/verify/{payment_id}": {
      "get": {
        "tags": [
          "Licensing"
        ],
        "summary": "Verify payment and retrieve the license",
        "operationId": "licenseVerify",
        "description": "Poll after sending payment, every 5 seconds. Returns 202 while waiting (status awaiting_payment, or payment_confirmed while the license is prepared), 200 with the license once issued, or 410 if the payment window expired. Licenses started before October 2026 have UUID payment_ids and still verify here.",
        "parameters": [
          {
            "name": "payment_id",
            "in": "path",
            "required": true,
            "description": "payment_id from the payment response, for example OCM-Q000123.",
            "schema": {
              "type": "string",
              "example": "OCM-Q000123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "License issued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenseIssuedResponse"
                }
              }
            }
          },
          "202": {
            "description": "Waiting for payment confirmation, or preparing the license.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AwaitingPaymentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Payment ID not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "No payment has been started for this quote.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "410": {
            "description": "Payment window expired. Start a new license.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpiredResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Track": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "417",
            "description": "Track id. Partner tracks look like partner_82."
          },
          "source": {
            "type": "string",
            "enum": [
              "onchain",
              "partner"
            ]
          },
          "source_label": {
            "type": "string",
            "description": "Partner label name (partner tracks only)."
          },
          "title": {
            "type": "string",
            "example": "Chase the Sunshine Full"
          },
          "album": {
            "type": [
              "string",
              "null"
            ]
          },
          "duration": {
            "type": [
              "string",
              "null"
            ],
            "example": "3:40"
          },
          "artists": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "genre": {
            "type": [
              "string",
              "null"
            ],
            "example": "Rock"
          },
          "subgenre": {
            "type": [
              "string",
              "null"
            ],
            "example": "Indie"
          },
          "mood": {
            "type": [
              "string",
              "null"
            ],
            "example": "Upbeat"
          },
          "bpm": {
            "type": [
              "integer",
              "null"
            ],
            "example": 120
          },
          "key": {
            "type": [
              "string",
              "null"
            ],
            "example": "G Maj"
          },
          "instrumental": {
            "type": "boolean",
            "description": "true = no vocals."
          },
          "keywords": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "artwork_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "preview_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "MP3 preview."
          },
          "formats_available": {
            "type": "object",
            "properties": {
              "mp3": {
                "type": "boolean"
              },
              "wav": {
                "type": "boolean"
              },
              "aif": {
                "type": "boolean"
              }
            }
          },
          "license_purchase_url": {
            "type": "string",
            "format": "uri",
            "description": "POST endpoint for the social_media license of this track."
          }
        }
      },
      "LicenseOption": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "social_media"
          },
          "name": {
            "type": "string",
            "example": "Social Media License"
          },
          "description": {
            "type": "string"
          },
          "price_usdc": {
            "type": "string",
            "example": "10.00"
          },
          "term": {
            "type": "string",
            "example": "perpetual"
          },
          "exclusivity": {
            "type": "string",
            "example": "non-exclusive"
          },
          "territories": {
            "type": "string",
            "example": "worldwide"
          },
          "permitted_uses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CatalogSearchResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Track"
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "per_page": {
                "type": "integer"
              },
              "current_page": {
                "type": "integer"
              },
              "last_page": {
                "type": "integer"
              },
              "fallback": {
                "type": "boolean",
                "description": "true if filters were relaxed to return results."
              },
              "sources": {
                "type": "object",
                "properties": {
                  "onchain": {
                    "type": "integer"
                  },
                  "partner": {
                    "type": "integer"
                  }
                }
              },
              "results_url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri",
                "description": "Opens every match on onchainmusic.com, where tracks can be previewed and licensed."
              }
            }
          },
          "licensing": {
            "type": "object",
            "description": "Standard license options keyed by type.",
            "additionalProperties": {
              "$ref": "#/components/schemas/LicenseOption"
            }
          }
        }
      },
      "TrackDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Track"
          },
          "licensing": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/LicenseOption"
            }
          }
        }
      },
      "LicenseRequest": {
        "type": "object",
        "required": [
          "paying_wallet"
        ],
        "properties": {
          "paying_wallet": {
            "type": "string",
            "pattern": "^0x[a-fA-F0-9]{40}$",
            "example": "0x6d749657EEF45aF46fA2B7c81A6a4C7636f45D64",
            "description": "Required. The Base wallet the USDC will be sent from."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Optional. Receives the license email with download links."
          },
          "country": {
            "type": "string",
            "pattern": "^[A-Za-z]{2}$",
            "example": "US",
            "description": "Optional. Two-letter country code of the licensee. Some partner tracks are only available in certain countries."
          },
          "licensee_name": {
            "type": "string",
            "maxLength": 255,
            "description": "Optional. Person or company that will hold the license. Printed on the agreement."
          },
          "project_title": {
            "type": "string",
            "maxLength": 255,
            "description": "Optional. Project or production title. Printed on the agreement."
          },
          "client_name": {
            "type": "string",
            "maxLength": 255,
            "description": "Optional. Client or brand, if different from the licensee."
          },
          "usage": {
            "type": "string",
            "maxLength": 2000,
            "description": "Optional. How the music will be used."
          },
          "sensitive": {
            "type": "string",
            "enum": [
              "yes",
              "no"
            ],
            "default": "no",
            "description": "Optional. yes if used with political, religious, or adult content. Never blocks the license: printed on the agreement as a disclosed use, which still requires written approval."
          },
          "altered": {
            "type": "string",
            "enum": [
              "yes",
              "no"
            ],
            "default": "no",
            "description": "Optional. yes if the music will be remixed, re-recorded, or have lyrics changed. Never blocks the license: printed on the agreement as a disclosed use, which still requires written approval."
          }
        }
      },
      "LicenseQuoteRequest": {
        "allOf": [
          {
            "type": "object",
            "required": [
              "track_id",
              "medium",
              "category",
              "territory",
              "term"
            ],
            "properties": {
              "licensee_type": {
                "type": "string",
                "enum": [
                  "business",
                  "personal"
                ],
                "default": "business",
                "description": "business for business licenses (default). personal applies the personal discount where a rate allows it."
              },
              "track_id": {
                "type": "string",
                "pattern": "^(partner_)?[0-9]+$",
                "example": "417",
                "description": "Track id exactly as returned by search: \"417\" for OnChain Music tracks, \"partner_82\" for partner catalog tracks."
              },
              "medium": {
                "type": "string",
                "example": "Commercials",
                "description": "From GET /license/options."
              },
              "category": {
                "type": "string",
                "description": "From GET /license/options."
              },
              "territory": {
                "type": "string",
                "description": "From GET /license/options."
              },
              "term": {
                "type": "string",
                "example": "1 Year",
                "description": "From GET /license/options."
              },
              "custom_months": {
                "type": "integer",
                "minimum": 1,
                "maximum": 36,
                "description": "Optional. Custom length in months, only where allows_custom_term is true. Priced in proportion to the 1 Year price."
              }
            }
          },
          {
            "$ref": "#/components/schemas/LicenseRequest"
          }
        ]
      },
      "LicenseOptionsResponse": {
        "type": "object",
        "properties": {
          "personal": {
            "type": "array",
            "description": "Personal (non-commercial) standard licenses.",
            "items": {
              "type": "object",
              "properties": {
                "license_type": {
                  "type": "string",
                  "example": "social_media"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "endpoint": {
                  "type": "string"
                },
                "price_usd": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          },
          "track": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "licensable": {
                "type": "boolean"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "how_to_license": {
            "type": "string"
          },
          "business": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "medium": {
                  "type": "string",
                  "example": "Commercials"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "categories": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string"
                      },
                      "territories": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "territory": {
                              "type": "string"
                            },
                            "terms": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "term": {
                                    "type": "string",
                                    "example": "1 Year"
                                  },
                                  "term_months": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "description": "null means perpetual."
                                  },
                                  "allows_custom_term": {
                                    "type": "boolean"
                                  },
                                  "notes": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "tier_prices_usd": {
                                    "type": "object",
                                    "properties": {
                                      "1": {
                                        "type": "integer"
                                      },
                                      "2": {
                                        "type": "integer"
                                      },
                                      "3": {
                                        "type": "integer"
                                      }
                                    }
                                  },
                                  "price_usd": {
                                    "type": "integer",
                                    "description": "This track's price. Present only when track_id is given and the track can be licensed."
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "The business rate card."
          }
        }
      },
      "PaymentRequiredResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "payment_required"
          },
          "message": {
            "type": "string"
          },
          "payment": {
            "type": "object",
            "properties": {
              "x402Version": {
                "type": "string",
                "example": "2"
              },
              "accepts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scheme": {
                      "type": "string",
                      "example": "exact"
                    },
                    "network": {
                      "type": "string",
                      "example": "base"
                    },
                    "asset": {
                      "type": "string",
                      "description": "USDC contract on Base."
                    },
                    "payTo": {
                      "type": "string"
                    },
                    "maxAmountRequired": {
                      "type": "string",
                      "description": "Amount in USDC base units (6 decimals).",
                      "example": "5000000"
                    }
                  }
                }
              },
              "x402_version": {
                "type": "string",
                "example": "1.0"
              },
              "payment_id": {
                "type": "string",
                "example": "OCM-Q000123"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "payment_details": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string",
                    "example": "base"
                  },
                  "chain_id": {
                    "type": "integer",
                    "example": 8453
                  },
                  "token": {
                    "type": "string",
                    "example": "USDC"
                  },
                  "receiving_address": {
                    "type": "string"
                  },
                  "amount_usdc": {
                    "type": "number",
                    "example": 5.0
                  },
                  "token_contract": {
                    "type": "string"
                  },
                  "paying_wallet": {
                    "type": "string"
                  }
                }
              },
              "track": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "artist": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "license_type": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "social_media or all_digital, or null for rate card options."
                  },
                  "license_name": {
                    "type": "string",
                    "example": "Social Media: Creator Content"
                  }
                }
              },
              "license": {
                "type": "object",
                "properties": {
                  "medium": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "territory": {
                    "type": "string"
                  },
                  "term": {
                    "type": "string"
                  },
                  "price_usd": {
                    "type": "number"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "terms_url": {
                "type": "string",
                "format": "uri",
                "description": "The license agreement. Initiating the license accepts it."
              },
              "instructions": {
                "type": "object"
              },
              "verify_url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "ReviewRequiredResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "review_required"
          },
          "quote_number": {
            "type": "string",
            "example": "OCM-Q000123"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ContactForQuoteResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "contact_for_quote"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "LicenseIssuedResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "license_issued"
          },
          "payment_id": {
            "type": "string",
            "example": "OCM-Q000123"
          },
          "license_number": {
            "type": "string",
            "example": "OCM-L000123"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "license_document": {
            "type": "object",
            "properties": {
              "license_id": {
                "type": "string",
                "example": "OCM-L000123"
              },
              "issued_at": {
                "type": "string",
                "format": "date-time"
              },
              "licensor": {
                "type": "string",
                "example": "OnChain Music, LLC"
              },
              "licensor_url": {
                "type": "string",
                "format": "uri"
              },
              "track": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "source": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "artist": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "license": {
                "type": "object",
                "properties": {
                  "medium": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "territory": {
                    "type": "string"
                  },
                  "term": {
                    "type": "string"
                  },
                  "exclusivity": {
                    "type": "string",
                    "example": "non-exclusive"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "payment": {
                "type": "object",
                "properties": {
                  "amount_usdc": {
                    "type": "number"
                  },
                  "token": {
                    "type": "string"
                  },
                  "chain": {
                    "type": "string"
                  },
                  "chain_id": {
                    "type": "integer"
                  },
                  "transaction_hash": {
                    "type": "string"
                  },
                  "confirmed_block": {
                    "type": "integer"
                  },
                  "paying_wallet": {
                    "type": "string"
                  },
                  "receiving_wallet": {
                    "type": "string"
                  }
                }
              },
              "signature": {
                "type": "string",
                "description": "HMAC-SHA256 of the other fields, for tamper detection."
              }
            }
          },
          "downloads": {
            "type": "object",
            "description": "Signed download link for each available format.",
            "properties": {
              "mp3": {
                "type": "string",
                "format": "uri"
              },
              "wav": {
                "type": "string",
                "format": "uri"
              },
              "aif": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "license_pdf_url": {
            "type": "string",
            "format": "uri",
            "description": "The signed license agreement PDF."
          },
          "links_expire_at": {
            "type": "string",
            "format": "date-time",
            "description": "Download and agreement links stop working after this time (30 days)."
          },
          "track": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            }
          }
        }
      },
      "AwaitingPaymentResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "awaiting_payment",
              "payment_confirmed"
            ]
          },
          "payment_id": {
            "type": "string",
            "example": "OCM-Q000123"
          },
          "message": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_after": {
            "type": "string",
            "example": "5 seconds"
          },
          "verify_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ExpiredResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "expired"
          },
          "payment_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "new_license_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "ValidationError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "Validation failed."
          },
          "details": {
            "type": "object"
          }
        }
      }
    }
  }
}