{
  "openapi": "3.1.0",
  "info": {
    "title": "tuka.events Vendor API",
    "version": "1.0.0",
    "summary": "Send events, venues or plain text to the tuka.events curators.",
    "description": "Every accepted request is stored and read within about two hours; a curator approves each event before it is published. `/api/v1` stays backward compatible: new optional fields and new endpoints may appear, and unknown request fields are ignored. Keys are issued by hand: write to info@tuka.events.",
    "contact": { "email": "info@tuka.events" }
  },
  "servers": [{ "url": "https://vendors.tuka.events/api/v1" }],
  "security": [{ "apiKey": [] }],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Check an API key",
        "description": "Stores nothing, so it is the safe way to test a key.",
        "responses": {
          "200": {
            "description": "The key works.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Me" } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/events": {
      "post": {
        "operationId": "submitEvent",
        "summary": "Send an event",
        "description": "One request per event and per date: a show on three evenings is three requests. An exhibition open every day is one, from its first day to its last.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Event" },
              "example": {
                "title": { "bg": "Вечер на джаза", "en": "Jazz Night" },
                "starts_at": "2026-12-12T20:00",
                "city": "sofia",
                "venue": { "name": "Sofia Live Club", "address": "bul. Vitosha 1" },
                "url": "https://example.com/jazz-night",
                "price": { "from": 15, "currency": "EUR" }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Duplicate" },
          "202": { "$ref": "#/components/responses/Accepted" },
          "400": { "$ref": "#/components/responses/InvalidJson" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "413": { "$ref": "#/components/responses/PayloadTooLarge" },
          "415": { "$ref": "#/components/responses/UnsupportedMediaType" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/venues": {
      "post": {
        "operationId": "submitVenue",
        "summary": "Send a venue",
        "description": "Only for a venue with no event yet: an event names its own venue. A curator adds it to the directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Venue" },
              "example": { "name": "Sofia Live Club", "address": "bul. Vitosha 1", "city": "sofia" }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Duplicate" },
          "202": { "$ref": "#/components/responses/Accepted" },
          "400": { "$ref": "#/components/responses/InvalidJson" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "413": { "$ref": "#/components/responses/PayloadTooLarge" },
          "415": { "$ref": "#/components/responses/UnsupportedMediaType" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/letters": {
      "post": {
        "operationId": "submitLetter",
        "summary": "Send plain text",
        "description": "The simplest way in: describe your events in your own words, as in a letter to your vendor address.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Letter" },
              "example": { "subject": "December programme", "text": "12 December, 20:00, Sofia Live Club: Jazz Night. Tickets from 15 EUR." }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Duplicate" },
          "202": { "$ref": "#/components/responses/Accepted" },
          "400": { "$ref": "#/components/responses/InvalidJson" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "413": { "$ref": "#/components/responses/PayloadTooLarge" },
          "415": { "$ref": "#/components/responses/UnsupportedMediaType" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }
    },
    "responses": {
      "Duplicate": {
        "description": "The same content was already accepted. Nothing new was stored.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Accepted" } } }
      },
      "Accepted": {
        "description": "Stored. It will be read and reach a curator; this is not yet an event on the site.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Accepted" } } }
      },
      "InvalidJson": {
        "description": "`invalid_json`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "PayloadTooLarge": {
        "description": "`payload_too_large`: the body is over 64 KB.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "UnsupportedMediaType": {
        "description": "`unsupported_media_type`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "ValidationFailed": {
        "description": "`validation_failed`: `error.fields` names each problem. Nothing was stored.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unauthorized": {
        "description": "`unauthorized` or `key_revoked`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "RateLimited": {
        "description": "`rate_limited`: over about 30 requests a minute. Wait for `Retry-After` seconds.",
        "headers": { "Retry-After": { "schema": { "type": "integer" } } },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unavailable": {
        "description": "`unavailable`: nothing was stored. Retry; an identical retry is safe.",
        "headers": { "Retry-After": { "schema": { "type": "integer" } } },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    },
    "schemas": {
      "Languages": {
        "type": "object",
        "description": "The text in any of our languages. One is enough; we write the others.",
        "properties": {
          "bg": { "type": "string" },
          "en": { "type": "string" },
          "ru": { "type": "string" }
        }
      },
      "City": {
        "type": "string",
        "description": "The city whose catalogue this goes in. Without it, your own city.",
        "enum": ["sofia", "plovdiv", "varna", "burgas", "ruse", "veliko_tarnovo", "blagoevgrad", "gabrovo", "lovech"]
      },
      "LocalTime": {
        "type": "string",
        "description": "Local time in the event's city as `YYYY-MM-DDTHH:MM`, or `YYYY-MM-DD` when the hour is not known. No offset.",
        "examples": ["2026-12-12T20:00", "2026-12-12"]
      },
      "Venue": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string", "maxLength": 200 },
          "address": { "type": "string", "maxLength": 500 },
          "city": { "$ref": "#/components/schemas/City" },
          "website": { "type": "string", "format": "uri" }
        }
      },
      "Price": {
        "type": "object",
        "properties": {
          "free": { "type": "boolean" },
          "from": { "type": "number", "minimum": 0, "description": "The lowest price. Requires `currency`." },
          "currency": { "type": "string", "enum": ["EUR", "BGN"] }
        }
      },
      "Event": {
        "type": "object",
        "required": ["title", "starts_at"],
        "properties": {
          "title": { "$ref": "#/components/schemas/Languages" },
          "starts_at": { "$ref": "#/components/schemas/LocalTime" },
          "ends_at": { "$ref": "#/components/schemas/LocalTime" },
          "description": { "$ref": "#/components/schemas/Languages" },
          "category": { "type": "string", "maxLength": 50, "description": "In your own words, such as `concert`. We choose our category from it." },
          "city": { "$ref": "#/components/schemas/City" },
          "venue": { "$ref": "#/components/schemas/Venue" },
          "url": { "type": "string", "format": "uri", "description": "The event's own page." },
          "ticket_url": { "type": "string", "format": "uri", "description": "Where a ticket is bought." },
          "price": { "$ref": "#/components/schemas/Price" },
          "for_kids": { "type": "boolean" }
        }
      },
      "Letter": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "subject": { "type": "string", "maxLength": 200 },
          "text": { "type": "string", "maxLength": 30000 }
        }
      },
      "Accepted": {
        "type": "object",
        "required": ["id", "status", "duplicate"],
        "properties": {
          "id": { "type": "string", "description": "Our reference for this content. Quote it when you write to us." },
          "status": { "type": "string", "enum": ["accepted"] },
          "duplicate": { "type": "boolean" }
        }
      },
      "Me": {
        "type": "object",
        "required": ["vendor_id", "expires_at"],
        "properties": {
          "vendor_id": { "type": "string", "format": "uuid" },
          "expires_at": { "type": "string", "format": "date-time" }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable: branch on this, not on `message`.",
                "enum": ["not_found", "method_not_allowed", "unauthorized", "key_revoked", "rate_limited", "unsupported_media_type", "payload_too_large", "invalid_json", "validation_failed", "unavailable"]
              },
              "message": { "type": "string" },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": ["field", "message"],
                  "properties": { "field": { "type": "string" }, "message": { "type": "string" } }
                }
              }
            }
          }
        }
      }
    }
  }
}
