{"openapi":"3.1.0","info":{"title":"editable qr code API","version":"1.0.0","description":"Create and inspect 25 QR formats, including menus and product pages. Base path /api/v1. Static formats embed their payload; dynamic formats use a tracked short link."},"servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"User-issued dashboard API key. Read scope for GET, write scope for mutations. This is not OAuth."},"AgentOAuth":{"type":"oauth2","description":"Registered Supabase client, PKCE S256 and explicit owner consent required. Read access, plus optional owner-approved creation. Creation does not allow editing, deleting or duplicating existing codes, billing or other owners. See /auth.md.","flows":{"authorizationCode":{"authorizationUrl":"https://jrsekyixqwycpgkhyimp.supabase.co/auth/v1/oauth/authorize","tokenUrl":"https://jrsekyixqwycpgkhyimp.supabase.co/auth/v1/oauth/token","scopes":{"offline_access":"Token refresh; QR read and optional creation permissions require explicit owner consent"}}}}},"schemas":{"QrCode":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"qr_type":{"type":"string"},"destination_url":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"is_paused":{"type":"boolean"},"status":{"type":"string","description":"active or awaiting_upload"},"short_url":{"type":"string","description":"Tracked destination for dynamic QR types only; static QR images embed their payload directly."},"content":{"type":"object","additionalProperties":true,"description":"Saved hosted-page content, returned by GET /qr-codes/{id}."},"links":{"type":"array","items":{"type":"object","required":["label","url"],"properties":{"label":{"type":"string"},"url":{"type":"string"},"platform":{"type":"string"}}}},"vcard":{"type":"object","additionalProperties":true},"static_payload":{"type":"object","additionalProperties":true,"description":"Private static content, including Wi-Fi credentials when configured. Treat as sensitive."},"media":{"type":"object","additionalProperties":true}}}}},"security":[{"ApiKeyAuth":[]}],"paths":{"/qr-codes":{"get":{"operationId":"listQrCodes","summary":"List QR codes","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"QR list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/QrCode"}},"next_cursor":{"type":["string","null"]}}}}}}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]},"post":{"summary":"Create a QR code (any type)","description":"Supply the payload matching qr_type: destination_url for url; vcard for vcard; name and links for link_list/social; media for image/video/pdf; the matching object for static formats; content for other hosted-page formats. Hosted content is validated per format. Media creation returns an upload_url; PUT the file there then call complete-upload. OAuth requires explicit creation consent. Media completion is limited to codes created by that same grant.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string"},"description":"Reuse for retries of the same creation request only. Required for OAuth creation; at most 200 characters."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["qr_type"],"properties":{"qr_type":{"type":"string","enum":["url","vcard","link_list","social","image","video","pdf","wifi","text","email","phone","sms","whatsapp","gs1","vcard_plus","mp3","business","coupon","product","event","menu","playlist","apps","feedback","landing"]},"name":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","maxLength":500},"fg_color":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#12151b"},"bg_color":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#ffffff"},"ecc_level":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","enum":["L","M","Q","H"],"default":"H"},"destination_url":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","maxLength":4096,"format":"uri","pattern":"^https?://","description":"HTTP or HTTPS URL without embedded credentials or control characters."},"content":{"type":"object","additionalProperties":true,"description":"Hosted-page content; required fields depend on qr_type. See the documented menu example."},"media":{"type":"object","required":["title"],"properties":{"title":{"type":"string"},"caption":{"type":"string"}}},"vcard":{"type":"object","required":["full_name"],"properties":{"full_name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone_mobile":{"type":"string"},"phone_work":{"type":"string"},"email_work":{"type":"string"},"email_home":{"type":"string"},"company":{"type":"string"},"title":{"type":"string"},"address_street":{"type":"string"},"address_city":{"type":"string"},"address_region":{"type":"string"},"address_postal_code":{"type":"string"},"address_country":{"type":"string"},"website_url":{"type":"string"},"note":{"type":"string"}}},"links":{"type":"array","minItems":1,"items":{"type":"object","required":["label","url"],"properties":{"label":{"type":"string"},"url":{"type":"string"},"platform":{"type":"string"}}}},"wifi":{"type":"object","required":["ssid"],"properties":{"ssid":{"type":"string"},"password":{"type":"string","description":"Required unless encryption is nopass."},"encryption":{"type":"string","enum":["WPA","WEP","nopass"],"default":"WPA"},"hidden":{"type":"boolean"}}},"text":{"type":"object","required":["content"],"properties":{"content":{"type":"string"}}},"email":{"type":"object","required":["to"],"properties":{"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}}},"sms":{"type":"object","required":["number"],"properties":{"number":{"type":"string"},"text":{"type":"string"}}},"phone":{"type":"object","required":["number"],"properties":{"number":{"type":"string"}}},"whatsapp":{"type":"object","required":["number"],"properties":{"number":{"type":"string"},"text":{"type":"string"}}},"gs1":{"type":"object","required":["element"],"properties":{"element":{"type":"string"}}}}},"examples":{"website":{"value":{"qr_type":"url","name":"Website","destination_url":"https://example.com"}},"menu":{"value":{"qr_type":"menu","name":"Cafe menu","content":{"restaurant":"Cafe","sections":[{"title":"Mains","items":[{"name":"Ramen","price":"18"}]}]}}},"pdf":{"value":{"qr_type":"pdf","media":{"title":"Brochure"}}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Bad request"},"409":{"description":"Cap reached"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]}},"/qr-codes/{id}":{"get":{"summary":"Fetch one QR","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Owned QR with saved content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QrCode"}}}},"404":{"description":"Not found"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]},"patch":{"summary":"Update name, destination, pause state or QR design","description":"Static payloads cannot be edited. Hosted-page content is not updated by this endpoint.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":500},"destination_url":{"type":"string","format":"uri","maxLength":4096},"is_paused":{"type":"boolean"},"fg_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"bg_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"ecc_level":{"type":"string","enum":["L","M","Q","H"]}}}}}},"responses":{"200":{"description":"Updated"},"400":{"description":"Invalid fields or empty update"},"404":{"description":"Not found or not owned by caller"}}},"delete":{"summary":"Delete (soft)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted flag and QR id"}}}},"/qr-codes/{id}/image":{"get":{"summary":"QR image","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"format","in":"query","schema":{"type":"string","enum":["png","svg"],"default":"png"}},{"name":"size","in":"query","schema":{"type":"integer","default":512}}],"responses":{"200":{"description":"Image bytes"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]}},"/qr-codes/{id}/duplicate":{"post":{"summary":"Duplicate a QR","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Clone created"}}}},"/qr-codes/{id}/analytics":{"get":{"summary":"Scan analytics","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Totals and breakdowns"},"404":{"description":"Not found"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]}},"/qr-codes/{id}/complete-upload":{"post":{"summary":"Validate and publish an uploaded media file","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Published"},"400":{"description":"Missing or invalid media"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}],"description":" OAuth requires explicit creation consent. Media completion is limited to codes created by that same grant."}},"/qr-codes/batch/upload":{"post":{"summary":"Initialize a direct media ZIP upload (25 MB compressed maximum)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["qr_type"],"properties":{"qr_type":{"type":"string","enum":["image","video","pdf"]}}}}}},"responses":{"201":{"description":"id, storage_path, upload_url and expires_at. PUT the ZIP to upload_url before submitting upload_id to /qr-codes/batch."}}}},"/qr-codes/batch":{"post":{"summary":"Queue up to 1000 JSON rows, or finalize a media ZIP with qr_type and upload_id (up to 100 files)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"qr_type":{"type":"string"},"rows":{"type":"array","maxItems":1000,"items":{"type":"object"}},"upload_id":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Batch id and status_url"},"400":{"description":"Invalid input"},"409":{"description":"Plan cap exceeded, or upload_in_progress: retry the same upload_id after Retry-After"}}}},"/batches/{id}":{"get":{"summary":"Batch status and per-row results","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Status and results"},"404":{"description":"Not found"}},"security":[{"ApiKeyAuth":[]},{"AgentOAuth":["offline_access"]}]}}}}