{"openapi":"3.0.3","info":{"title":"sp-tickets API","version":"1.0.0","description":"Tenant-scoped REST API for the sp-tickets ticketing platform. A product from Smart Products company."},"servers":[{"url":"https://your-tenant.sp-tickets.stuff-testing.lol/api"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Use an API key generated in Settings → API keys."}},"schemas":{"Ticket":{"type":"object","properties":{"id":{"type":"string"},"ref":{"type":"string","example":"T-0001"},"subject":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["new","open","pending","resolved","closed"]},"category_id":{"type":"string","nullable":true},"priority_id":{"type":"string","nullable":true},"assignee_id":{"type":"string","nullable":true},"source":{"type":"string","enum":["web","email","api"]},"at_risk":{"type":"boolean"},"breached":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"response_due_at":{"type":"string","nullable":true}}}}},"security":[{"bearerAuth":[]}],"paths":{"/me":{"get":{"summary":"Current token identity and permissions","responses":{"200":{"description":"OK"}}}},"/categories":{"get":{"summary":"List categories","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"object"}}}}}}}}}},"/priorities":{"get":{"summary":"List priorities","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"priorities":{"type":"array","items":{"type":"object"}}}}}}}}}},"/tickets":{"get":{"summary":"List tickets","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["new","open","pending","resolved","closed"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ref":{"type":"string","example":"T-0001"},"subject":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["new","open","pending","resolved","closed"]},"category_id":{"type":"string","nullable":true},"priority_id":{"type":"string","nullable":true},"assignee_id":{"type":"string","nullable":true},"source":{"type":"string","enum":["web","email","api"]},"at_risk":{"type":"boolean"},"breached":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"response_due_at":{"type":"string","nullable":true}}}}}}}}}}},"post":{"summary":"Create a ticket","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subject"],"properties":{"subject":{"type":"string"},"description":{"type":"string"},"category_id":{"type":"string"},"priority_id":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Validation error"},"403":{"description":"Missing ticket.create"}}}},"/tickets/{id}":{"get":{"summary":"Get a ticket","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}},"patch":{"summary":"Update a ticket (fields need their own permission)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"description":{"type":"string"},"category_id":{"type":"string"},"priority_id":{"type":"string"},"status":{"type":"string"},"assignee_id":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"403":{"description":"Missing permission"},"409":{"description":"Invalid status transition"}}}},"/tickets/{id}/comments":{"get":{"summary":"List comments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"type":"object"}}}}}}}}},"post":{"summary":"Add a comment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"},"internal":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Created"}}}}}}