{
  "openapi": "3.1.1",
  "info": {
    "title": "Vienna Human Requests API",
    "version": "1.0.0",
    "summary": "Request anything legal in Vienna and the surrounding area, done by Vienna Human GmbH's own team.",
    "description": "Same fields as the web form at https://staging.vienna-human.com/#request. No authentication, no API key, no CAPTCHA.\n\nA first reply reaches the user within 5 minutes, 24/7, on the channel they chose, with a quote or an honest no. Nothing is booked by submitting.\n\nOnly submit with your user's agreement, using their own email address or phone number. Don't invent budgets or dates (use `open_to_offers` or `timeframe: flexible`).\n\nHuman-readable docs: https://staging.vienna-human.com/agents",
    "contact": {
      "name": "Vienna Human GmbH",
      "email": "hello@vienna-human.com",
      "url": "https://staging.vienna-human.com/agents"
    }
  },
  "servers": [
    {
      "url": "https://staging.vienna-human.com"
    }
  ],
  "externalDocs": {
    "description": "Agent documentation",
    "url": "https://staging.vienna-human.com/agents"
  },
  "tags": [
    {
      "name": "requests",
      "description": "Submit a request"
    }
  ],
  "paths": {
    "/api/requests": {
      "post": {
        "tags": [
          "requests"
        ],
        "operationId": "createRequest",
        "summary": "Submit a request",
        "description": "Stores the request and notifies the team. Retries are safe: send an `Idempotency-Key`, or resend the identical body within 24 hours, and you get the same reference back (HTTP 200) without creating a second request.",
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Unique key per request (a UUID is ideal), 1–255 visible ASCII characters. A retry with the same key and body returns the original reference.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "pattern": "^[\\x21-\\x7E]+$"
            },
            "example": "0b6f1c2e-6a4f-4f7e-9d38-0e1c4a6b2f11"
          },
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "Language of error messages (`en` or `de`) if the body has no valid `language`.",
            "schema": {
              "type": "string"
            },
            "example": "de-AT"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "UTF-8 JSON object, max. 64 KB.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestCreate"
              },
              "examples": {
                "whatsapp": {
                  "summary": "Queueing, reply via WhatsApp",
                  "value": {
                    "category": "onsite",
                    "task": "Queue for Staatsoper standing room, Sat 14:00",
                    "budget_eur": 60,
                    "timeframe": "date",
                    "date": "2026-12-06",
                    "area": "1010",
                    "name": "Ada Muster",
                    "contact_channel": "whatsapp",
                    "phone": "+43 660 1234567",
                    "language": "en",
                    "agent_name": "ExampleAssistant",
                    "on_behalf_of": "Ada Muster"
                  }
                },
                "email": {
                  "summary": "Delivery, flexible timing, reply via email",
                  "value": {
                    "category": "delivery",
                    "task": "Pick up a framed print from a gallery in Neubau and deliver it to Döbling",
                    "open_to_offers": true,
                    "timeframe": "flexible",
                    "area": "1070",
                    "name": "Max Muster",
                    "contact_channel": "email",
                    "email": "max@example.com",
                    "language": "de"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Duplicate of an earlier request (same Idempotency-Key, or identical body within 24 hours). Nothing new was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestAccepted"
                },
                "example": {
                  "reference": "VH-2026-7KQ2MX",
                  "status": "received",
                  "reply_within": "PT5M",
                  "reply_via": "whatsapp"
                }
              }
            }
          },
          "202": {
            "description": "Received. Pass the reference on to your user; we contact them within 5 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestAccepted"
                },
                "example": {
                  "reference": "VH-2026-7KQ2MX",
                  "status": "received",
                  "reply_within": "PT5M",
                  "reply_via": "whatsapp"
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON, or the Idempotency-Key header is malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "errors": [
                    {
                      "field": null,
                      "code": "invalid_json",
                      "message": "The body is not valid JSON."
                    }
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Body larger than 64 KB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "errors": [
                    {
                      "field": null,
                      "code": "too_long",
                      "message": "Request body too large (max 64 KB)."
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Content-Type is not application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed. Every problem is listed; fix them and resend. Also returned when an Idempotency-Key is reused for a different body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "errors": [
                    {
                      "field": "phone",
                      "code": "required_for_channel",
                      "message": "Enter a phone number to get replies via WhatsApp, or choose Email."
                    },
                    {
                      "field": "date",
                      "code": "required_if",
                      "message": "Choose the date, today or later."
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this IP. Wait for the number of seconds in Retry-After.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "errors": [
                    {
                      "field": null,
                      "code": "rate_limited",
                      "message": "Too many requests. Try again in 45 seconds."
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable. Retry after Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RequestCreate": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "errands",
              "delivery",
              "event",
              "onsite",
              "other"
            ],
            "description": "Type of task. Use `other` if nothing fits."
          },
          "task": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000,
            "description": "What needs doing, in English or German. No sensitive data (health, ID, bank details)."
          },
          "budget_eur": {
            "description": "Total budget in whole euros. Use your user's number; don't invent one.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100000
          },
          "open_to_offers": {
            "default": false,
            "description": "true if the user wants us to suggest a price.",
            "type": "boolean"
          },
          "timeframe": {
            "type": "string",
            "enum": [
              "asap",
              "today",
              "48h",
              "week",
              "date",
              "flexible"
            ],
            "description": "When it needs to happen (Europe/Vienna)."
          },
          "date": {
            "description": "YYYY-MM-DD, today or later (Europe/Vienna). Required if timeframe is `date`.",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "area": {
            "type": "string",
            "enum": [
              "1010",
              "1020",
              "1030",
              "1040",
              "1050",
              "1060",
              "1070",
              "1080",
              "1090",
              "1100",
              "1110",
              "1120",
              "1130",
              "1140",
              "1150",
              "1160",
              "1170",
              "1180",
              "1190",
              "1200",
              "1210",
              "1220",
              "1230",
              "umland",
              "unsure"
            ],
            "description": "Vienna postcode \"1010\"–\"1230\", \"umland\" (surrounding area) or \"unsure\"."
          },
          "location": {
            "description": "Address, landmark, station or town. Required if area is `umland`.",
            "type": "string",
            "maxLength": 300
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The user's name."
          },
          "contact_channel": {
            "type": "string",
            "enum": [
              "email",
              "phone",
              "whatsapp",
              "signal",
              "telegram"
            ],
            "description": "How we reply."
          },
          "email": {
            "description": "Required if contact_channel is `email`. Must belong to the person who wants the task done.",
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "phone": {
            "description": "International format, e.g. +43 660 1234567 (Austrian numbers without a country code are accepted). Required for phone, whatsapp, signal and telegram.",
            "type": "string",
            "minLength": 6,
            "maxLength": 30,
            "pattern": "^[+0-9 ()\\-/]+$"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "de"
            ],
            "description": "Language of our reply."
          },
          "agent_name": {
            "description": "Which AI assistant is sending this.",
            "type": "string",
            "maxLength": 100
          },
          "on_behalf_of": {
            "description": "Whom the assistant acts for, if not the name above.",
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "category",
          "task",
          "timeframe",
          "area",
          "name",
          "contact_channel",
          "language"
        ],
        "description": "Same fields as the web form. Unknown fields are ignored.",
        "allOf": [
          {
            "if": {
              "properties": {
                "timeframe": {
                  "const": "date"
                }
              },
              "required": [
                "timeframe"
              ]
            },
            "then": {
              "required": [
                "date"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "area": {
                  "const": "umland"
                }
              },
              "required": [
                "area"
              ]
            },
            "then": {
              "required": [
                "location"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "contact_channel": {
                  "const": "email"
                }
              },
              "required": [
                "contact_channel"
              ]
            },
            "then": {
              "required": [
                "email"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "contact_channel": {
                  "enum": [
                    "phone",
                    "whatsapp",
                    "signal",
                    "telegram"
                  ]
                }
              },
              "required": [
                "contact_channel"
              ]
            },
            "then": {
              "required": [
                "phone"
              ]
            }
          }
        ]
      },
      "RequestAccepted": {
        "type": "object",
        "required": [
          "reference",
          "status",
          "reply_within",
          "reply_via"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "pattern": "^VH-\\d{4}-[0-9A-HJKMNP-TV-Z]{6}$",
            "description": "Reference for your user, e.g. for follow-ups.",
            "examples": [
              "VH-2026-7KQ2MX"
            ]
          },
          "status": {
            "type": "string",
            "const": "received"
          },
          "reply_within": {
            "type": "string",
            "const": "PT5M",
            "description": "ISO 8601 duration until the first reply."
          },
          "reply_via": {
            "type": "string",
            "enum": [
              "email",
              "phone",
              "whatsapp",
              "signal",
              "telegram"
            ],
            "description": "The channel we reply on."
          }
        }
      },
      "Errors": {
        "type": "object",
        "required": [
          "errors"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "field",
                "code",
                "message"
              ],
              "properties": {
                "field": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Request field (or header) concerned; null for the whole request."
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "required",
                    "invalid",
                    "too_short",
                    "too_long",
                    "out_of_range",
                    "required_if",
                    "required_for_channel",
                    "invalid_json",
                    "rate_limited",
                    "unavailable",
                    "not_found"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable, in the request's language."
                }
              }
            }
          }
        }
      }
    }
  }
}