{"openapi":"3.1.0","info":{"title":"TierBook Cloud Lead API","version":"1.0","description":"A sponsor's own system reads and captures the leads of the one sponsorship its key belongs to. Keys are\ncreated in the sponsor portal (Leads \u2192 API keys) when the organizer sells Lead API access. Shared attendee\nfields follow the event's lead-sharing settings for the API. Envelope `{ ok, data, meta, error }`; anything\noutside the key's sponsorship is 404.\n"},"servers":[{"url":"https://app.tierbook.com/api/lead/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"tbl_{prefix}_{secret}"}},"parameters":{"lead":{"name":"lead","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Error":{"description":"Error envelope","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}},"schemas":{"Note":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"body":{"type":"string"},"author":{"type":"string"},"edited_at":{"type":"string","format":"date-time"}}},"Lead":{"type":"object","description":"Shared profile fields and answers depend on the event's lead-sharing settings.","properties":{"uuid":{"type":"string","format":"uuid"},"rating":{"type":["integer","null"]},"follow_up_status":{"type":"string"},"qualifying":{"type":"object"},"captured_at":{"type":"string","format":"date-time"},"notes":{"type":"array","items":{"$ref":"#/components/schemas/Note"}},"updated_at":{"type":"string","format":"date-time"}}}}},"paths":{"/context":{"get":{"summary":"The key, event, sponsorship, shared fields, ratings and follow-up statuses","responses":{"200":{"description":"data: { key{name,prefix}, event, sponsorship{id,code,name}, shared{profile,questions}, ratings, follow_up_statuses }"},"401":{"$ref":"#/components/responses/Error"}}}},"/leads":{"get":{"summary":"Leads, oldest change first (cursor pages)","parameters":[{"name":"since","in":"query","description":"Only leads changed since this time","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"data: Lead[]; meta: { next_cursor, has_more }"}}}},"/leads/{lead}":{"get":{"summary":"One lead","parameters":[{"$ref":"#/components/parameters/lead"}],"responses":{"200":{"description":"data: Lead"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Set rating, follow-up status or qualifying answers","parameters":[{"$ref":"#/components/parameters/lead"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"integer"},"follow_up_status":{"type":"string"},"qualifying":{"type":"object"}}}}}},"responses":{"200":{"description":"data: Lead"}}}},"/leads/{lead}/notes":{"get":{"summary":"Notes on a lead","parameters":[{"$ref":"#/components/parameters/lead"}],"responses":{"200":{"description":"data: Note[]"}}},"post":{"summary":"Add a note (send your own uuid to make retries safe)","parameters":[{"$ref":"#/components/parameters/lead"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"},"uuid":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"data: Note"},"422":{"$ref":"#/components/responses/Error"}}}},"/scans":{"post":{"summary":"Capture leads from badge credentials (up to 100; idempotent per operation_id)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["scans"],"properties":{"scans":{"type":"array","items":{"type":"object","required":["operation_id","credential"],"properties":{"operation_id":{"type":"string"},"credential":{"type":"string"},"scanned_at":{"type":"string","format":"date-time"}}}}}}}}},"responses":{"200":{"description":"data: [{ operation_id, result, lead: Lead|null }]"}}}}}}