{"openapi":"3.1.0","info":{"title":"API do CRM imobiliário","version":"1.0.0","description":"API servidor a servidor por imobiliária. Autentique com `Authorization: Bearer ck_live_...`. Nunca use a chave em código de navegador. Escopos: properties:read, leads:read, leads:read_contact, leads:create."},"servers":[{"url":"/api/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"NewLead":{"type":"object","required":["name","phone","consent"],"properties":{"name":{"type":"string"},"phone":{"type":"string","description":"Telefone brasileiro"},"email":{"type":"string"},"message":{"type":"string"},"kind":{"type":"string","enum":["buyer","owner"]},"property_code":{"type":"string"},"neighborhood":{"type":"string"},"consent":{"type":"object","required":["text_version"],"properties":{"text_version":{"type":"string","description":"Versão do texto de consentimento que a pessoa aceitou no seu sistema"}}},"attribution":{"type":"object","description":"utm_source, utm_medium, utm_campaign, utm_content, utm_term, gclid, fbclid, landing_url, referrer"}}}}},"paths":{"/me":{"get":{"summary":"Imobiliária, escopos e limite desta chave","responses":{"200":{"description":"OK"},"401":{"description":"Chave ausente, inválida, revogada ou vencida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Escopo ausente ou imobiliária em só leitura","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite por minuto (Retry-After) ou teto diário de contatos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/properties":{"get":{"summary":"Imóveis publicados (dados públicos). Escopo properties:read","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Só registros alterados desde esta data."},{"name":"after","in":"query","schema":{"type":"string"},"description":"Cursor devolvido em next_cursor."}],"responses":{"200":{"description":"OK"},"401":{"description":"Chave ausente, inválida, revogada ou vencida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Escopo ausente ou imobiliária em só leitura","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite por minuto (Retry-After) ou teto diário de contatos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads":{"get":{"summary":"Leads. Escopo leads:read; include=contact exige leads:read_contact e conta no teto de 500 contatos/dia","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Só registros alterados desde esta data."},{"name":"after","in":"query","schema":{"type":"string"},"description":"Cursor devolvido em next_cursor."},{"name":"include","in":"query","schema":{"type":"string","enum":["contact"]}}],"responses":{"200":{"description":"OK"},"401":{"description":"Chave ausente, inválida, revogada ou vencida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Escopo ausente ou imobiliária em só leitura","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite por minuto (Retry-After) ou teto diário de contatos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Cria lead (escopo leads:create). Entra no rodízio e no prazo de resposta.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewLead"}}}},"responses":{"200":{"description":"Repetição da mesma Idempotency-Key (cabeçalho Idempotent-Replayed)"},"201":{"description":"Criado"},"401":{"description":"Chave ausente, inválida, revogada ou vencida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Escopo ausente ou imobiliária em só leitura","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Idempotency-Key usada com outro corpo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Dados inválidos (telefone, consentimento)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite por minuto (Retry-After) ou teto diário de contatos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}