Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mivicall.com/llms.txt

Use this file to discover all available pages before exploring further.

A API Mivicall segue convenções REST standard. Errors devolvem JSON estruturado:
{
  "error": "validation_failed",
  "message": "patientPhone must be E.164 format",
  "requestId": "uuid-...",
  "errors": [
    { "path": "patientPhone", "message": "Invalid format" }
  ]
}
O requestId é único por request — sempre incluam-no em pedidos de suporte.

Códigos HTTP

CodeSignificadoAcção
200 OKSucessoProcessar resposta
201 CreatedRecurso criadoGuardar ID retornado
204 No ContentSucesso sem body(ex: DELETE)
400 Bad RequestPayload mal-formadoVerificar JSON, encoding
401 UnauthorizedAPI key inválida/revogadaVerificar Authorization header
403 ForbiddenScope insuficienteGerar key com scope necessário
404 Not FoundRecurso inexistenteVerificar ID
409 ConflictConflito de estadoRe-fetch e re-aplicar
422 Unprocessable EntityValidação Zod falhouVer errors[] para detalhes
429 Too Many RequestsRate limitBackoff exponencial
500 Internal Server ErrorErro nossoRetry depois; reportar com requestId
502 Bad GatewayUpstream indisponívelRetry com backoff
503 Service UnavailableManutençãoVer mivicall.com/status

Codes de erro específicos

Ler error field para distinguir causas dentro do mesmo HTTP code:

401 Unauthorized

invalid_api_key       — key não existe ou foi revogada
expired_api_key       — key expirou (rotação anual)
malformed_auth_header — header Authorization mal formado

403 Forbidden

insufficient_scope    — key não tem o scope necessário
tenant_inactive       — clínica em status suspended
no_org_context        — JWT sem org_id (não acontece com API keys)

404 Not Found

appointment_not_found
professional_not_found
service_not_found
tenant_not_provisioned — onboarding incompleto

409 Conflict

slot_conflict         — outro paciente já marcou esse slot
status_transition     — não pode passar de cancelled → attended
duplicate_idempotency — Idempotency-Key já usado com payload diferente

422 Unprocessable Entity

Validação Zod falhou. errors[] array com cada falha:
{
  "error": "validation_failed",
  "message": "Invalid request body",
  "requestId": "...",
  "errors": [
    { "path": "professionalId", "message": "Expected uuid" },
    { "path": "startsAt",       "message": "Expected ISO 8601 datetime" }
  ]
}

Retry policy recomendada

CodeRetry?Backoff
4xx (excepto 408, 429)Não
408 Request TimeoutSimLinear, 3 tentativas
429 Too Many RequestsSimExponential, respeitar Retry-After
500 Internal Server ErrorSimExponential, max 5 tentativas
502 Bad GatewaySimExponential, max 5
503 Service UnavailableSimExponential, respeitar Retry-After
504 Gateway TimeoutSimExponential, max 3

Quando contactar suporte

Inclui sempre:
  • requestId da resposta
  • Timestamp UTC
  • API key prefix (primeiros 8 chars, NÃO a key completa)
  • Endpoint + method
  • Payload enviado (sem PII)
  • Resposta recebida
Email: support@mivicall.com com assunto [API Error] {error_code}.