{"openapi":"3.1.0","info":{"title":"EZPZ API","version":"v1","description":"The agency API. Rate limits: a key gets 600 calls a minute and 50,000 a day by default; an app session 300 a minute and 20,000 a day. Over the limit the answer is 429 with Retry-After. Test keys (ezpz_test_) work only in your sandbox, where nothing calls, texts, files or bills."},"servers":[{"url":"https://www.buildezpz.com"}],"security":[{"bearer":[]}],"paths":{"/api/v1/leads":{"get":{"summary":"List leads, newest first. phone finds a lead by its number in any common US spelling; email by its address as typed or in lower case.","operationId":"get_leads","tags":["lead"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"phone","in":"query","required":false,"schema":{"type":"string"}},{"name":"email","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create a lead. Once your agency signs the key's consent promise in Studio, a lead the key posts with a phone can get texts. sms_consent: {text, at} is optional: the person's own consent words and when, kept as the proof. Before the promise is signed, a lead needs them to get texts.","operationId":"post_leads","tags":["lead"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","description":"First name."},"last_name":{"type":"string","description":"Last name."},"phone":{"type":"string","description":"Phone number."},"email":{"type":"string","description":"Email."},"state":{"type":"string","description":"Two-letter state."},"zip":{"type":"string","description":"ZIP code."},"age":{"type":"integer","minimum":0,"maximum":130,"description":"Age."},"product_type":{"type":"string","description":"Product type: mp, iul, fex, annu or life."},"lead_type":{"type":"string","description":"A lead type by its key (the agent’s own or the agency’s). The lead takes the type’s base product, whatever product_type says."},"lead_type_id":{"type":"string","description":"A lead type by its id. Same as lead_type."},"notes":{"type":"string","description":"Notes."},"sms_consent":{"type":"object","description":"Only when the person agreed to texts: their own words and when. Never implied. A proposal that carries this always waits for the user to approve it, even on autopilot.","properties":{"text":{"type":"string","description":"What they agreed to, in their words."},"at":{"type":"string","description":"When, ISO 8601."}},"required":["text","at"],"additionalProperties":false}},"required":["first_name"],"additionalProperties":false}}}}}},"/api/v1/leads/{id}":{"get":{"summary":"Get one lead.","operationId":"get_leads_id","tags":["lead"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Change its name, phone, email, state or product (first_name, last_name, phone, email, state, product_type), its agency fields (custom) or its stage (stage_id). A note is its own call (below). address and source are refused.","operationId":"patch_leads_id","tags":["lead"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"custom":{"type":"object","description":"Agency fields to set, keyed by field key (ezpz_list_fields)."},"stage_id":{"type":"string","description":"The stage to move it to (st_…, ezpz_list_stages)."}},"additionalProperties":false}}}}}},"/api/v1/leads/{id}/notes":{"post":{"summary":"Add a note. It shows in the lead's notes.","operationId":"post_leads_id_notes","tags":["lead"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","description":"The note."}},"required":["body"],"additionalProperties":false}}}}}},"/api/v1/leads/{id}/tags":{"post":{"summary":"Add or remove tags: {add?, remove?}, lists of tag names.","operationId":"post_leads_id_tags","tags":["lead"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/leads/{id}/appointments":{"post":{"summary":"Book an appointment.","operationId":"post_leads_id_appointments","tags":["lead"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"starts_at":{"type":"string","description":"Start, ISO 8601 with a zone."},"ends_at":{"type":"string","description":"End, ISO 8601 with a zone."},"timezone":{"type":"string","description":"IANA time zone, e.g. America/Denver."},"title":{"type":"string","description":"Title."},"notes":{"type":"string","description":"Notes."},"meet":{"type":"boolean","description":"Add a video link."}},"required":["starts_at","ends_at"],"additionalProperties":false}}}}}},"/api/v1/policies":{"get":{"summary":"List policies.","operationId":"get_policies","tags":["policy"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Policy"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Record a sale on a lead your key's creator owns: {lead_id, ap_cents, commission_pct, close_date, …}. The lead closes, as on the screen.","operationId":"post_policies","tags":["policy"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/policies/{id}":{"get":{"summary":"Get one policy.","operationId":"get_policies_id","tags":["policy"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Change a sale your key's creator owns.","operationId":"patch_policies_id","tags":["policy"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/appointments":{"get":{"summary":"List appointments.","operationId":"get_appointments","tags":["appointment"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Appointment"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/appointments/{id}":{"get":{"summary":"Get one appointment.","operationId":"get_appointments_id","tags":["appointment"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/calls":{"get":{"summary":"List calls.","operationId":"get_calls","tags":["call"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Call"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/calls/{id}":{"get":{"summary":"Get one call.","operationId":"get_calls_id","tags":["call"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Call"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/messages":{"get":{"summary":"List text messages.","operationId":"get_messages","tags":["message"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/agents":{"get":{"summary":"List the agents your key can see.","operationId":"get_agents","tags":["agent"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/agents/{id}":{"get":{"summary":"Get one agent.","operationId":"get_agents_id","tags":["agent"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/roles":{"get":{"summary":"List your agency's custom roles.","operationId":"get_roles","tags":["role"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Role"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/fields":{"get":{"summary":"List your agency's custom fields.","operationId":"get_fields","tags":["field"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/stages":{"get":{"summary":"List your agency's stages.","operationId":"get_stages","tags":["stage"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Stage"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/tables":{"get":{"summary":"List the custom tables live in your agency, each with its fields.","operationId":"get_tables","tags":["table"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Table"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/tables/{id}":{"get":{"summary":"Get one table.","operationId":"get_tables_id","tags":["table"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Table"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/records":{"get":{"summary":"List one table's records, newest first. table_id is required. A list past your agency's rows-per-filter limit (20,000 unless raised) answers 422 too_many_rows: narrow it by owner_id or updated_since.","operationId":"get_records","tags":["record"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"table_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"owner_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create a record: {table_id, owner_id?, data}, data keyed by field key. Without owner_id it belongs to your key's default owner (a shared table's records have none). Link fields are read-only.","operationId":"post_records","tags":["record"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"table_id":{"type":"string","description":"The table (tb_…)."},"owner_id":{"type":"string","description":"Whose record it is (ag_…). Default: the connection’s own."},"data":{"type":"object","description":"Values keyed by the table’s field keys (ezpz_list_tables)."}},"required":["table_id","data"],"additionalProperties":false}}}}}},"/api/v1/records/{id}":{"get":{"summary":"Get one record.","operationId":"get_records_id","tags":["record"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Change some of its values: {data}, keyed by field key; null clears one.","operationId":"patch_records_id","tags":["record"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"Values to set, keyed by field key."}},"required":["data"],"additionalProperties":false}}}}},"delete":{"summary":"Delete it.","operationId":"delete_records_id","tags":["record"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/agency":{"get":{"summary":"Get your agency.","operationId":"get_agency","tags":["agency"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agency"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/kpi_days":{"get":{"summary":"One row per agent per day between from and to (dates, at most 93 days). agent_id is optional.","operationId":"get_kpi_days","tags":["kpi_day"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","required":true,"schema":{"type":"string"}},{"name":"to","in":"query","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KpiDay"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/sales":{"get":{"summary":"Every sale on your agency's book, oldest change first. Unlike other lists, next_cursor is never null after your first sale: store it and pass it back as cursor to get only what is new, changed or deleted since. Fewer rows than limit means you are caught up. Changes appear after about 10 seconds. A key sees sales posted after it was created. Needs Team production at Agency reach.","operationId":"get_sales","tags":["sale"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/calls/{id}/recording":{"get":{"summary":"The call's audio: a 302 to a fresh short-lived file link. Needs calls.listen on the call's owner.","operationId":"get_calls_id_recording","tags":["call"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"302":{"description":"Location: the file link","headers":{"Location":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/hooks":{"get":{"summary":"An app install's webhook subscriptions, newest first.","operationId":"get_hooks","tags":["hooks"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string"},"target_url":{"type":"string"},"status":{"type":"string","enum":["live","paused","gone"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","event","target_url","status","created_at"]}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Subscribe a target URL to one event. An app install only: a personal install hears its own lead, policy, appointment, call and text events; an agency install hears what its key reads. Each event carries what the same token could GET.","operationId":"post_hooks","tags":["hooks"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RunOrigin"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target_url":{"type":"string"},"event":{"type":"string"}},"required":["target_url","event"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string"},"target_url":{"type":"string"},"status":{"type":"string","enum":["live","paused","gone"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","event","target_url","status","created_at"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/hooks/{id}":{"delete":{"summary":"Unsubscribe one of the calling install's own subscriptions.","operationId":"delete_hooks_id","tags":["hooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/RunOrigin"}],"responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/auth/exchange":{"post":{"summary":"Exchange an embedded app's frame token for a session (ezpz_sess_…). Called from the app's own registered origin.","operationId":"post_auth_exchange","tags":["auth"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"]}}}},"responses":{"200":{"description":"A session","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string"},"expires_in":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/views/{slug}":{"get":{"summary":"A custom endpoint your agency saved in Studio › API & webhooks: one resource, its filters and its fields. It runs as your key.","description":"The view is the query: only `cursor`, `limit` (default: the view's own) and the resource's own time floor are taken — `updated_since` on lead and record views, `since` on policy, appointment, call, message and agent views. Any other parameter is 400 `unknown_param`. Some filters run after the page is read, so a page may hold fewer items than `limit` (even none) while `next_cursor` is still set: keep paging until it is null. A sale view pages like `GET /api/v1/sales` (a feed: store `next_cursor` and poll with it). A slug your agency has not saved, or a key the view does not name, is 404.","operationId":"get_views_slug","tags":["views"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9-]{3,40}$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Lead and record views.","schema":{"type":"string","format":"date-time"}},{"name":"since","in":"query","required":false,"description":"Policy, appointment, call, message and agent views.","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/Lead"},{"$ref":"#/components/schemas/Policy"},{"$ref":"#/components/schemas/Appointment"},{"$ref":"#/components/schemas/Call"},{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/Agent"},{"$ref":"#/components/schemas/Record"},{"$ref":"#/components/schemas/Sale"}]}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}}},"webhooks":{"lead.created":{"post":{"summary":"A lead was added.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"lead.created"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Lead"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"lead.updated":{"post":{"summary":"A lead's fields or agency field values changed.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"lead.updated"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Lead"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"lead.stage_changed":{"post":{"summary":"The disposition or the agency stage moved.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"lead.stage_changed"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Lead"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"lead.moved":{"post":{"summary":"The lead moved to another agent.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"lead.moved"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Lead"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"lead.deleted":{"post":{"summary":"A lead was deleted.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"lead.deleted"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Lead"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"policy.created":{"post":{"summary":"A policy was recorded.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"policy.created"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Policy"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"policy.updated":{"post":{"summary":"A policy changed.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"policy.updated"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Policy"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"policy.sold":{"post":{"summary":"A policy was sold (inserted, or its stage or close date set).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"policy.sold"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Policy"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"policy.deleted":{"post":{"summary":"A policy was deleted.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"policy.deleted"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Policy"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"appointment.booked":{"post":{"summary":"An appointment was booked.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"appointment.booked"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Appointment"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"appointment.rescheduled":{"post":{"summary":"Its time moved.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"appointment.rescheduled"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Appointment"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"appointment.outcome":{"post":{"summary":"Its outcome or status was set.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"appointment.outcome"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Appointment"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"appointment.deleted":{"post":{"summary":"An appointment was deleted.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"appointment.deleted"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Appointment"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"call.started":{"post":{"summary":"A call began.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"call.started"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Call"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"call.ended":{"post":{"summary":"A call ended.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"call.ended"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Call"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"message.sent":{"post":{"summary":"An outbound text was sent (direction outbound).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"message.sent"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Message"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"message.received":{"post":{"summary":"An inbound text arrived (direction inbound).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"message.received"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Message"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"record.created":{"post":{"summary":"A custom-table record was added (Phase 3).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"record.created"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Record"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"record.updated":{"post":{"summary":"A record or its links changed (Phase 3).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"record.updated"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Record"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"record.deleted":{"post":{"summary":"A record was deleted (Phase 3).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"record.deleted"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Record"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"onboarding_call.booked":{"post":{"summary":"Someone booked an onboarding call on one of the agency's onboarding pages.","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"onboarding_call.booked"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/OnboardingCall"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}},"kpi_day.updated":{"post":{"summary":"An agent's day changed; keyed by (agent, date).","description":"Signed per endpoint (Standard Webhooks: ezpz-id, ezpz-timestamp, ezpz-signature). A 2xx answer is a delivery.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"kpi_day.updated"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/KpiDay"},"changed":{"type":"array","items":{"type":"string"}}},"required":["id","type","created_at","data"]}}}},"responses":{"200":{"description":"Received"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"`ezpz_live_…` (a live API key), `ezpz_test_…` (a sandbox key), or `ezpz_sess_…` (an embedded app's session)."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string. The same key and body within 24 hours replays the first answer; the same key with another body is 422.","schema":{"type":"string","maxLength":255}},"RunOrigin":{"name":"X-EZPZ-Run-Origin","in":"header","required":false,"description":"Sent back by your endpoint when an automation called it: the run id and hop, signed. Marks the write as the automation's.","schema":{"type":"string"}}},"responses":{"Error":{"description":"Refused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Over the rate limit","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Lead":{"type":"object","description":"A person an agent is working: contact facts, where they came from, and where they stand.","properties":{"object":{"type":"string","const":"lead"},"id":{"type":"string","description":"The lead id."},"owner_id":{"type":"string","description":"The agent who owns the record (an `agent` id)."},"first_name":{"type":["string","null"],"description":"First name."},"last_name":{"type":["string","null"],"description":"Last name."},"email":{"type":["string","null"],"description":"Email address."},"phone":{"type":["string","null"],"description":"Phone number, E.164 where known."},"state":{"type":["string","null"],"description":"Two-letter US state."},"zip":{"type":["string","null"],"description":"ZIP code."},"age":{"type":["integer","null"],"description":"Age in years, as given."},"disposition":{"type":"string","description":"The fixed disposition (new_lead, called, booked, sold, …). Canonical; `stage` is the agency's word for it."},"stage":{"type":["object","null"],"description":"The agency stage it shows: `{id, key, label}`, or null for the fixed label."},"source":{"type":"string","description":"Where the lead came from (facebook, transferred, mail_in, manual, …). A lead created through this API reads `manual`."},"product_type":{"type":"string","description":"The product line the lead asked about (mp, iul, fex, annu or life). A lead filed on a lead type holds the type's base product."},"lead_type":{"type":["object","null"],"description":"The lead type it is filed on: `{key, label}` — the agent's or the agency's own type, which works like its `product_type`. Null for a plain product."},"tags":{"type":"array","items":{},"description":"Tags, as strings."},"notes":{"type":["string","null"],"description":"The agent's notes on the lead."},"score":{"type":["integer","null"],"description":"Lead score, 0–100."},"score_warmth_label":{"type":["string","null"],"description":"The warmth word beside the score."},"call_count":{"type":"integer","description":"The current call streak."},"dial_attempts":{"type":"integer","description":"Every dial ever placed to the lead."},"voicemails_left":{"type":"integer","description":"Voicemails left."},"callback_at":{"type":["string","null"],"format":"date-time","description":"A scheduled callback."},"closed_at":{"type":["string","null"],"format":"date-time","description":"When the lead was closed."},"last_touched_at":{"type":"string","format":"date-time","description":"The last time anyone acted on the lead."},"last_dialed_at":{"type":["string","null"],"format":"date-time","description":"The last dial."},"last_inbound_at":{"type":["string","null"],"format":"date-time","description":"The last inbound text or call."},"cost_cents":{"type":"integer","description":"What the lead cost (cents)."},"campaign_id":{"type":["string","null"],"description":"The ad campaign it came from (an EZPZ campaign id)."},"origin_channel":{"type":["string","null"],"description":"The channel it first arrived through."},"referred_by_lead_id":{"type":["string","null"],"description":"The lead who referred this one."},"custom":{"type":"object","description":"The agency's own fields, keyed by field key.","additionalProperties":true},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the record last changed."}},"required":["object","id","owner_id","disposition","source","product_type","tags","call_count","dial_attempts","voicemails_left","last_touched_at","cost_cents","custom","created_at","updated_at"]},"Policy":{"type":"object","description":"A sale (or a policy in motion) on a lead: carrier, product, premium and where it stands.","properties":{"object":{"type":"string","const":"policy"},"id":{"type":"string","description":"The policy id."},"lead_id":{"type":"string","description":"The lead it was sold to."},"owner_id":{"type":"string","description":"The agent who owns the record (an `agent` id)."},"ap_cents":{"type":"integer","description":"Annual premium (cents)."},"advanced_pay_cents":{"type":"integer","description":"Advance paid (cents)."},"commission_cents":{"type":"integer","description":"Commission (cents)."},"commission_pct":{"type":["number","null"],"description":"Commission percent (two decimals)."},"face_amount_cents":{"type":["integer","null"],"description":"Face amount (cents)."},"carrier_name":{"type":["string","null"],"description":"Carrier."},"carrier_product":{"type":["string","null"],"description":"Carrier product."},"policy_number":{"type":["string","null"],"description":"Policy number."},"policy_stage":{"type":"string","description":"Where the policy stands (submitted, issued, paid, lapsed, …)."},"policy_stage_at":{"type":"string","format":"date-time","description":"When it reached that stage."},"close_date":{"type":"string","format":"date","description":"The sale date."},"effective_date":{"type":["string","null"],"format":"date","description":"The policy effective date."},"sold_reason":{"type":["string","null"],"description":"Why it sold, as noted."},"policy_note":{"type":["string","null"],"description":"The agent's note on the policy."},"client_first_name":{"type":["string","null"],"description":"The insured's first name, when not the lead."},"client_last_name":{"type":["string","null"],"description":"The insured's last name, when not the lead."},"call_id":{"type":["string","null"],"description":"The call it closed on."},"custom":{"type":"object","description":"The agency's own fields, keyed by field key.","additionalProperties":true},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the record last changed."}},"required":["object","id","lead_id","owner_id","ap_cents","advanced_pay_cents","commission_cents","policy_stage","policy_stage_at","close_date","custom","created_at","updated_at"]},"Appointment":{"type":"object","description":"A booked meeting with a lead and what came of it.","properties":{"object":{"type":"string","const":"appointment"},"id":{"type":"string","description":"The appointment id."},"lead_id":{"type":"string","description":"The lead it is with."},"owner_id":{"type":"string","description":"The agent who owns the record (an `agent` id)."},"starts_at":{"type":"string","format":"date-time","description":"Start."},"ends_at":{"type":"string","format":"date-time","description":"End."},"timezone":{"type":["string","null"],"description":"The IANA time zone it was booked in."},"status":{"type":"string","enum":["scheduled","cancelled","completed","no_show"],"description":"Its state."},"outcome":{"type":["string","null"],"description":"What happened at the meeting."},"title":{"type":["string","null"],"description":"Title."},"notes":{"type":["string","null"],"description":"Notes."},"source":{"type":["string","null"],"description":"How it was booked."},"created_by":{"type":["string","null"],"description":"Who booked it (an `agent` id)."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the record last changed."}},"required":["object","id","lead_id","owner_id","starts_at","ends_at","status","created_at","updated_at"]},"Call":{"type":"object","description":"A phone call, inbound or outbound, and how it went.","properties":{"object":{"type":"string","const":"call"},"id":{"type":"string","description":"The call id."},"lead_id":{"type":["string","null"],"description":"The lead on the call, when known."},"owner_id":{"type":"string","description":"The agent who owns the record (an `agent` id)."},"direction":{"type":"string","description":"inbound or outbound."},"status":{"type":"string","description":"The call state (ringing, in_progress, completed, no_answer, …)."},"started_at":{"type":["string","null"],"format":"date-time","description":"When it started."},"answered_at":{"type":["string","null"],"format":"date-time","description":"When it was answered."},"ended_at":{"type":["string","null"],"format":"date-time","description":"When it ended."},"duration_sec":{"type":["integer","null"],"description":"Talk time in seconds."},"voicemail":{"type":"boolean","description":"A voicemail was left or taken."},"from_number":{"type":"string","description":"From."},"to_number":{"type":"string","description":"To."},"caller_name":{"type":["string","null"],"description":"Caller name, when known."},"placed_by_actor_id":{"type":["string","null"],"description":"Who placed it, when not the owner (an `agent` id)."},"answered_by":{"type":["string","null"],"description":"Who picked up (human or machine), when detected."},"recording_duration_sec":{"type":["integer","null"],"description":"Recording length in seconds."},"has_recording":{"type":"boolean","description":"A recording exists and has not been purged."},"transcription":{"type":["string","null"],"description":"The call transcript, when one was made."},"recording_link":{"type":["string","null"],"description":"A stable link to the audio while it exists: `GET` it with a key holding `calls.listen` for the call's owner and it answers 302 to a fresh short-lived file link (404 once the audio is gone). Null without `calls.listen`, or when there is no recording."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","owner_id","direction","status","voicemail","from_number","to_number","has_recording","created_at"]},"Message":{"type":"object","description":"A text message to or from a lead.","properties":{"object":{"type":"string","const":"message"},"id":{"type":"string","description":"The message id."},"lead_id":{"type":["string","null"],"description":"The lead, when known."},"owner_id":{"type":"string","description":"The agent who owns the record (an `agent` id)."},"direction":{"type":"string","description":"inbound or outbound."},"body":{"type":"string","description":"The text."},"status":{"type":"string","description":"Delivery state."},"from_number":{"type":"string","description":"From."},"to_number":{"type":"string","description":"To."},"num_media":{"type":["integer","null"],"description":"Attached media count."},"send_origin":{"type":["string","null"],"description":"What sent it (manual, automation, …)."},"sent_by_kind":{"type":["string","null"],"description":"owner, delegate or echo."},"sent_by_actor_id":{"type":["string","null"],"description":"Who sent it, when not the owner (an `agent` id)."},"read_at":{"type":["string","null"],"format":"date-time","description":"When the agent read it."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","owner_id","direction","body","status","from_number","to_number","created_at"]},"Agent":{"type":"object","description":"A person on the agency's team.","properties":{"object":{"type":"string","const":"agent"},"id":{"type":"string","description":"The agent id."},"full_name":{"type":["string","null"],"description":"Full name."},"display_name":{"type":["string","null"],"description":"The name they go by."},"business_name":{"type":["string","null"],"description":"Their business name."},"email":{"type":"string","description":"Email."},"phone":{"type":["string","null"],"description":"Phone."},"agency_id":{"type":["string","null"],"description":"Their agency."},"role":{"type":["string","null"],"enum":["agency_owner","agency_admin","agency_assistant","member"],"description":"Their seat in the agency; null when they hold none."},"manager_id":{"type":["string","null"],"description":"Their upline manager."},"npn":{"type":["string","null"],"description":"National Producer Number."},"timezone":{"type":["string","null"],"description":"IANA time zone."},"work_state":{"type":["string","null"],"description":"Home work state."},"avatar_url":{"type":["string","null"],"description":"Avatar image URL."},"status":{"type":"string","description":"Account status."},"custom":{"type":"object","description":"The agency's own fields, keyed by field key.","additionalProperties":true},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","email","status","custom","created_at"]},"Role":{"type":"object","description":"A custom role the agency defined in Studio, and the switches it grants.","properties":{"object":{"type":"string","const":"role"},"id":{"type":"string","description":"The role id."},"agency_id":{"type":"string","description":"The defining agency."},"name":{"type":"string","description":"Name."},"description":{"type":"string","description":"Description."},"switches":{"type":"object","description":"Switch key → the reaches it grants (a data switch) or `true` (an agency-wide switch)."},"push_mode":{"type":["string","null"],"enum":["offered","suggested","extendable","locked"],"description":"Pushed to the agencies below: offered, suggested, extendable or locked; null = not pushed."},"status":{"type":"string","enum":["draft","live","retired"],"description":"draft, live or retired."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","agency_id","name","description","switches","status","created_at"]},"Field":{"type":"object","description":"A custom field the agency defined on leads, policies or agents.","properties":{"object":{"type":"string","enum":["lead","policy","agent"],"description":"What it is on."},"id":{"type":"string","description":"The field id."},"agency_id":{"type":"string","description":"The defining agency."},"key":{"type":"string","description":"The key its values appear under in `custom`."},"label":{"type":"string","description":"Label."},"type":{"type":"string","description":"Field type (text, number, date, select, multi_select, checkbox, …)."},"options":{"type":"array","items":{},"description":"Choices `{value, label}` for a pick field."},"required":{"type":"boolean","description":"Required."},"help":{"type":"string","description":"Help text."},"position":{"type":"integer","description":"Display order."},"push_mode":{"type":["string","null"],"enum":["offered","suggested","extendable","locked"],"description":"Pushed to the agencies below; null = not pushed."},"status":{"type":"string","enum":["draft","live","retired"],"description":"draft, live or retired."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","agency_id","object","key","label","type","options","required","help","position","status","created_at"]},"Stage":{"type":"object","description":"An agency stage: the agency's own word for one of the fixed dispositions.","properties":{"object":{"type":"string","const":"stage"},"id":{"type":"string","description":"The stage id."},"agency_id":{"type":"string","description":"The defining agency."},"key":{"type":"string","description":"Key."},"label":{"type":"string","description":"Label."},"maps_to":{"type":"string","description":"The fixed disposition it counts as."},"tone":{"type":["string","null"],"description":"Dot colour."},"position":{"type":"integer","description":"Display order."},"push_mode":{"type":["string","null"],"enum":["offered","suggested","extendable","locked"],"description":"Pushed to the agencies below; null = not pushed."},"status":{"type":"string","enum":["draft","live","retired"],"description":"draft, live or retired."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","agency_id","key","label","maps_to","position","status","created_at"]},"Table":{"type":"object","description":"A custom table that applies in your agency: its own, or one pushed to it. Only live tables are listed.","properties":{"object":{"type":"string","const":"table"},"id":{"type":"string","description":"The table id."},"agency_id":{"type":"string","description":"The defining agency."},"key":{"type":"string","description":"Key."},"name":{"type":"string","description":"Name."},"record_noun":{"type":"string","description":"What one record is called."},"icon":{"type":["string","null"],"description":"Icon name."},"shared":{"type":"boolean","description":"Shared across the agency."},"on_lead":{"type":"boolean","description":"Shown on the lead card."},"status":{"type":"string","enum":["draft","live","retired"],"description":"draft, live or retired."},"fields":{"type":"array","items":{},"description":"Its fields `[{key, label, type, options, required}]` — the keys a record's `data` uses. A `link` field is read-only here (its values are `links`). Health-shaped fields are never included."}},"required":["object","id","agency_id","key","name","record_noun","shared","on_lead","status","fields"]},"Record":{"type":"object","description":"A record in a custom table. `owner_id` is null on an agency-shared table.","properties":{"object":{"type":"string","const":"record"},"id":{"type":"string","description":"The record id."},"table_id":{"type":"string","description":"Its table."},"agency_id":{"type":"string","description":"The agency."},"owner_id":{"type":["string","null"],"description":"The agent who owns the record (an `agent` id)."},"title":{"type":"string","description":"Title: the value of the table's first text field."},"data":{"type":"object","description":"Values keyed by the table's field KEY (not the definition id). Health-shaped fields are never included."},"links":{"type":"array","items":{},"description":"What it links to `[{kind, id}]` (kind: record, lead or policy) — only targets your key can read. Read-only in v1."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the record last changed."},"custom":{"type":"object","description":"The agency's own fields, keyed by field key.","additionalProperties":true}},"required":["object","id","table_id","agency_id","title","data","links","created_at","updated_at"]},"Agency":{"type":"object","description":"The agency itself and where it sits in the tree.","properties":{"object":{"type":"string","const":"agency"},"id":{"type":"string","description":"The agency id."},"name":{"type":"string","description":"Name."},"parent_id":{"type":["string","null"],"description":"The agency above it, if any."},"tier":{"type":"string","description":"Agency kind (portal, enterprise, external, spinoff)."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."}},"required":["object","id","name","tier","created_at"]},"KpiDay":{"type":"object","description":"One agent's numbers for one day, computed from the ledgers. Id `kd_<agent uuid>_<YYYY-MM-DD>`. Totals: not subject to the consent rule, like Team production.","properties":{"object":{"type":"string","const":"kpi_day"},"id":{"type":"string","description":"The day id: `kd_<agent uuid>_<date>`."},"agent_id":{"type":"string","description":"The agent."},"date":{"type":"string","format":"date","description":"The day, in the agent's time zone."},"dials":{"type":"integer","description":"Dials."},"contacts":{"type":"integer","description":"Contacts."},"appointments_set":{"type":"integer","description":"Appointments booked."},"appointments_held":{"type":"integer","description":"Appointments held."},"presentations":{"type":"integer","description":"Presentations."},"closes":{"type":"integer","description":"Closes."},"texts_sent":{"type":"integer","description":"Texts sent."},"talk_seconds":{"type":"integer","description":"Talk time (seconds)."},"leads_received":{"type":"integer","description":"New leads received."},"ap_cents":{"type":"integer","description":"Annual premium closed (cents)."},"spend_cents":{"type":"integer","description":"Ad and lead spend (cents)."},"lead_cost_cents":{"type":"integer","description":"The summed cost of the leads received (cents)."},"cost_per_lead_cents":{"type":["integer","null"],"description":"DERIVED: spend_cents ÷ leads_received, rounded; null when no leads."},"cost_per_close_cents":{"type":["integer","null"],"description":"DERIVED: spend_cents ÷ closes, rounded; null when no closes."}},"required":["object","id","agent_id","date","dials","contacts","appointments_set","appointments_held","presentations","closes","texts_sent","talk_seconds","leads_received","ap_cents","spend_cents","lead_cost_cents"]},"Sale":{"type":"object","description":"A sale posted to the agency's book of business, with the agent who posted it. Read-only, oldest change first: poll `GET /api/v1/sales` with the `next_cursor` you got last time to get every new, changed or deleted sale once, and upsert each by `id`. Changes appear after about 10 seconds. A deleted sale comes back with `deleted: true`. An API key sees the sales posted after it was created.","properties":{"object":{"type":"string","const":"sale"},"id":{"type":"string","description":"The sale id."},"agent_email":{"type":"string","description":"The agent's sign-in email, lower-cased."},"agent_contact_email":{"type":["string","null"],"description":"The agent's contact email, when they set one apart from the sign-in email."},"agent_first_name":{"type":["string","null"],"description":"The first word of the agent's full name. EZPZ stores one full name; this is a split of it. Null when the name is blank."},"agent_last_name":{"type":["string","null"],"description":"The rest of the agent's full name after the first word. Null when the name is one word or blank."},"annual_premium_cents":{"type":"integer","description":"Annual premium (cents): the monthly premium × 12."},"carrier":{"type":["string","null"],"description":"The carrier."},"product":{"type":["string","null"],"description":"The product within the carrier."},"sale_date":{"type":"string","format":"date","description":"The sale date the agent entered; when none, the day it was posted (Mountain time)."},"status":{"type":"string","description":"Where it stands, as entered: Submitted, Submitted - Pending Requirements, Packet Received, Issue Paid, Canceled, Declined, Lapsed or Chargeback. Empty when none is set yet."},"counted":{"type":"boolean","description":"It counts toward premium totals: a status is set and it is not Canceled, Declined, Lapsed or Chargeback. Always false when `deleted`."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the sale last changed; on a deleted sale, when it was deleted."},"deleted":{"type":"boolean","description":"The sale was deleted. Its other fields are the last values it had."}},"required":["object","id","agent_email","annual_premium_cents","sale_date","status","counted","created_at","updated_at","deleted"]},"OnboardingCall":{"type":"object","description":"An onboarding call someone booked on one of the agency's onboarding pages (Desk ▸ Booking). Sent as the `onboarding_call.booked` webhook; there is no /api/v1 route for it yet. A key gets it when it holds `team.production` at a reach covering the whole agency (the sales feed's rule).","properties":{"object":{"type":"string","const":"onboarding_call"},"id":{"type":"string","description":"The onboarding call id."},"full_name":{"type":"string","description":"The name the person typed when they booked."},"email":{"type":"string","description":"The email they typed, lower-cased."},"phone":{"type":"string","description":"The phone they typed, as typed."},"member_email":{"type":["string","null"],"description":"Set when the email is an agency member's: the member it matched. Null for someone who has not joined."},"host_email":{"type":"string","description":"The sign-in email of the staff member whose page it was booked on, lower-cased. They host the call."},"starts_at":{"type":"string","format":"date-time","description":"When the call starts."},"ends_at":{"type":"string","format":"date-time","description":"When the call ends."},"timezone":{"type":"string","description":"The page's time zone (an IANA name, e.g. America/Chicago)."},"meet_link":{"type":["string","null"],"description":"The Google Meet link, when the calendar made one."},"status":{"type":"string","enum":["booked","done","no_show","cancelled"],"description":"Where it stands: booked, then done, no_show or cancelled."},"created_at":{"type":"string","format":"date-time","description":"When the record was created."},"updated_at":{"type":"string","format":"date-time","description":"When the record last changed."}},"required":["object","id","full_name","email","phone","host_email","starts_at","ends_at","timezone","status","created_at","updated_at"]},"Error":{"type":"object","properties":{"error":{"type":"string","description":"A stable snake_case code."}},"required":["error"]}}}}