{
  "openapi": "3.1.0",
  "info": {
    "title": "ACC Public Recording Metadata",
    "version": "1.0.0",
    "description": "Shared public metadata contract for Core declarations, published account certificates and HUMAN LEGACY. Not an identity, ownership, file-match or legal-clearance decision. Account registration and partner issuance require separate activation."
  },
  "servers": [
    {
      "url": "https://www.artclearancecertification.org",
      "description": "Canonical ACC public API host"
    }
  ],
  "paths": {
    "/api/v1/catalog/search": {
      "get": {
        "operationId": "searchPublicRecordingMetadata",
        "security": [],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 160
            },
            "description": "At least two text characters or a complete supported identifier. Only recorded public metadata is indexed."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 800
            },
            "description": "Opaque query-bound nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Public results, possibly empty",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid search/cursor"
          },
          "503": {
            "description": "Temporarily unavailable, not a negative certification result"
          }
        }
      }
    },
    "/api/v1/catalog/records/{certificateId}": {
      "get": {
        "operationId": "readPublicRecordingMetadata",
        "security": [],
        "parameters": [
          {
            "name": "certificateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact public record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "description": "Invalid certificate identifier"
          },
          "404": {
            "description": "No public record, including drafts"
          },
          "503": {
            "description": "Public metadata unavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RecordingMetadata": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "title",
          "artistName",
          "creatorName",
          "declaredProducerName",
          "isrc",
          "iswc",
          "authors",
          "releaseTitle",
          "mainPerformer",
          "bandName",
          "labelName",
          "labelCode",
          "producerName",
          "firstReleaseDate",
          "releaseYear",
          "releaseCountry",
          "durationMs"
        ],
        "properties": {
          "schemaVersion": {
            "const": "acc-recording-metadata-v1"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "artistName": {
            "type": [
              "string",
              "null"
            ]
          },
          "creatorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "declaredProducerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "isrc": {
            "type": [
              "string",
              "null"
            ]
          },
          "iswc": {
            "type": [
              "string",
              "null"
            ]
          },
          "authors": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "ipi",
                "roles"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "ipi": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "roles": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "enum": [
                      "composer",
                      "author",
                      "lyricist",
                      "arranger"
                    ]
                  },
                  "uniqueItems": true
                }
              }
            }
          },
          "releaseTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "mainPerformer": {
            "type": [
              "string",
              "null"
            ]
          },
          "bandName": {
            "type": [
              "string",
              "null"
            ]
          },
          "labelName": {
            "type": [
              "string",
              "null"
            ]
          },
          "labelCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstReleaseDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "releaseYear": {
            "type": [
              "integer",
              "null"
            ]
          },
          "releaseCountry": {
            "type": [
              "string",
              "null"
            ]
          },
          "durationMs": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "Record": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "certificateId",
          "recordType",
          "category",
          "status",
          "issuedAt",
          "verificationUrl",
          "metadata",
          "boundary"
        ],
        "properties": {
          "certificateId": {
            "type": "string",
            "pattern": "^ACC-[A-Z0-9-]+$"
          },
          "recordType": {
            "enum": [
              "declaration",
              "historical"
            ]
          },
          "category": {
            "enum": [
              "HUMAN",
              "SEMI_MIX",
              "AI_GEN",
              "HUMAN_LEGACY"
            ]
          },
          "status": {
            "type": "string"
          },
          "issuedAt": {
            "type": "string"
          },
          "verificationUrl": {
            "type": "string",
            "format": "uri"
          },
          "metadata": {
            "$ref": "#/components/schemas/RecordingMetadata"
          },
          "boundary": {
            "type": "string"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query",
          "normalizedQuery",
          "results",
          "nextCursor",
          "source",
          "boundary"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "normalizedQuery": {
            "type": "string"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "const": "acc-core"
          },
          "boundary": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "type": "object",
              "required": [
                "certificateId",
                "recordType",
                "category",
                "status",
                "title",
                "artistName",
                "issuedAt",
                "verificationUrl",
                "matchedFields"
              ],
              "properties": {
                "certificateId": {
                  "type": "string",
                  "pattern": "^ACC-[A-Z0-9-]+$"
                },
                "recordType": {
                  "enum": [
                    "declaration",
                    "historical"
                  ]
                },
                "category": {
                  "enum": [
                    "HUMAN",
                    "SEMI_MIX",
                    "AI_GEN",
                    "HUMAN_LEGACY"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "issuedAt": {
                  "type": "string"
                },
                "verificationUrl": {
                  "type": "string",
                  "format": "uri"
                },
                "metadata": {
                  "$ref": "#/components/schemas/RecordingMetadata"
                },
                "title": {
                  "type": "string"
                },
                "artistName": {
                  "type": "string"
                },
                "matchedFields": {
                  "type": "array",
                  "items": {
                    "enum": [
                      "certificateId",
                      "title",
                      "artistName",
                      "creatorName",
                      "declaredProducerName",
                      "isrc",
                      "iswc",
                      "authorName",
                      "authorIpi",
                      "releaseTitle",
                      "mainPerformer",
                      "bandName",
                      "labelName",
                      "labelCode",
                      "producerName",
                      "authorRoles",
                      "firstReleaseDate",
                      "releaseYear",
                      "releaseCountry",
                      "durationMs",
                      "category",
                      "status",
                      "issuedAt"
                    ]
                  },
                  "minItems": 1
                }
              }
            }
          }
        }
      }
    }
  }
}
