# Solicitar reset de senha via email (público) ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /request-password-reset: post: summary: Solicitar reset de senha via email (público) deprecated: false description: >- Envia email de reset de senha para o usuário. **Endpoint público** para integração com sistemas externos (não requer autenticação). operationId: requestPasswordReset tags: - Usuários - Usuários parameters: [] requestBody: content: application/json: schema: type: object required: - email properties: email: type: string format: email description: Email do usuário examples: - usuario@exemplo.com redirect_url: type: string format: uri description: URL de redirecionamento após clicar no link (opcional) examples: - https://mediconnectbrasil.netlify.app/reset-password x-apidog-orders: - email - redirect_url examples: basic: value: email: usuario@exemplo.com summary: Reset básico with_redirect: value: email: usuario@exemplo.com redirect_url: https://mediconnectbrasil.netlify.app/reset-password summary: Reset com redirect customizado responses: '200': description: Email de reset enviado com sucesso content: application/json: schema: type: object properties: success: type: boolean examples: - true message: type: string examples: - >- Email de reset de senha enviado com sucesso. Verifique sua caixa de entrada. x-apidog-orders: - success - message example: success: true message: >- Email de reset de senha enviado com sucesso. Verifique sua caixa de entrada. headers: {} x-apidog-name: OK '400': description: Email inválido ou dados incorretos content: application/json: schema: type: object properties: type: type: string title: type: string status: type: integer detail: type: string extras: type: object x-apidog-orders: [] x-apidog-orders: - type - title - status - detail - extras examples: '2': summary: email_invalido value: type: https://docs.mediconnectai.com/errors/validation title: Validation Error status: 400 detail: Email inválido extras: field: email issues: - code: invalid_string message: Email inválido path: - email '3': summary: url_invalida value: type: https://docs.mediconnectai.com/errors/validation title: Validation Error status: 400 detail: URL de redirecionamento inválida extras: field: redirect_url headers: {} x-apidog-name: Bad Request '500': description: Erro interno ao enviar email content: application/json: schema: type: object properties: {} example: type: https://docs.mediconnectai.com/errors/internal title: Internal Server Error status: 500 detail: Erro ao enviar email de reset de senha headers: {} x-apidog-name: Internal Server Error security: [] x-apidog-folder: Usuários x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23209845-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Criar usuário com role ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /functions/v1/create-user: post: summary: Criar usuário com role deprecated: false description: Cria usuário completo com profile, role e envio de magic link operationId: createUser tags: - Usuários - Edge Functions - Usuários parameters: [] requestBody: content: application/json: schema: type: object required: - email - full_name - role properties: email: type: string format: email full_name: type: string phone: type: string role: type: string enum: - admin - gestor - medico - secretaria - paciente create_patient_record: type: boolean description: Se true, cria registro na tabela patients cpf: type: string pattern: ^\d{11}$ description: Obrigatório se create_patient_record=true phone_mobile: type: string description: Obrigatório se create_patient_record=true x-apidog-orders: - email - full_name - phone - role - create_patient_record - cpf - phone_mobile example: email: paciente@exemplo.com full_name: Maria Santos phone: (11) 99999-9999 role: paciente create_patient_record: true cpf: '12345678901' phone_mobile: (11) 99999-9999 responses: '200': description: Usuário criado com sucesso content: application/json: schema: type: object properties: user: type: object x-apidog-orders: [] profile: type: object x-apidog-orders: [] role: type: string x-apidog-orders: - user - profile - role headers: {} x-apidog-name: OK '400': type: object properties: error: type: string example: Erro ao processar requisição details: type: string example: Detalhes técnicos do erro description: '' headers: {} x-apidog-name: Bad Request security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] x-apidog-folder: Usuários x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104945-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Informações do usuário autenticado ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /functions/v1/user-info: post: summary: Informações do usuário autenticado deprecated: false description: Retorna dados completos do usuário, profile e roles operationId: getUserInfo tags: - Usuários - Edge Functions - Usuários parameters: [] responses: '200': description: Informações do usuário content: application/json: schema: type: object properties: user: type: object x-apidog-orders: [] properties: {} profile: type: object x-apidog-orders: [] properties: {} roles: type: array items: type: string x-apidog-orders: - user - profile - roles headers: {} x-apidog-name: OK security: - Combination: [] x-apidog: required: true schemeGroups: - id: UyOy9vsDiuzuLFRk_IsgI schemeIds: - Combination use: id: UyOy9vsDiuzuLFRk_IsgI x-apidog-folder: Usuários x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104946-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Informações de usuário por ID ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /functions/v1/user-info-by-id: post: summary: Informações de usuário por ID deprecated: false description: Retorna dados de usuário específico (apenas admin/gestor) operationId: getUserInfoById tags: - Usuários - Edge Functions - Usuários parameters: [] requestBody: content: application/json: schema: type: object required: - user_id properties: user_id: type: string format: uuid x-apidog-orders: - user_id example: user_id: 123e4567-e89b-12d3-a456-426614174000 responses: '200': description: Informações do usuário headers: {} x-apidog-name: OK '403': description: Sem permissão headers: {} x-apidog-name: Forbidden security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] x-apidog-folder: Usuários x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104947-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Enviar SMS via Twilio ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /functions/v1/send-sms: post: summary: Enviar SMS via Twilio deprecated: false description: Envia SMS usando Twilio (requer configuração de secrets) operationId: sendSMS tags: - SMS - Edge Functions - Comunicação parameters: [] requestBody: content: application/json: schema: type: object required: - phone_number - message properties: phone_number: type: string examples: - '+5511999999999' message: type: string examples: - 'Lembrete: consulta amanhã às 10h' patient_id: type: string format: uuid x-apidog-orders: - phone_number - message - patient_id example: phone_number: '+5511999999999' message: 'Lembrete: sua consulta é amanhã às 10h na Clínica MediConnect' patient_id: 123e4567-e89b-12d3-a456-426614174000 responses: '200': description: SMS enviado com sucesso content: application/json: schema: type: object properties: success: type: boolean message_sid: type: string x-apidog-orders: - success - message_sid headers: {} x-apidog-name: OK '400': type: object properties: error: type: string example: Erro ao processar requisição details: type: string example: Detalhes técnicos do erro description: '' headers: {} x-apidog-name: Bad Request security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] x-apidog-folder: SMS x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104951-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Enviar Magic Link ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /auth/v1/otp: post: summary: Enviar Magic Link deprecated: false description: Envia link de autenticação sem senha por email operationId: sendMagicLink tags: - Autenticação - Autenticação parameters: [] requestBody: content: application/json: schema: type: object required: - email properties: email: type: string format: email examples: - usuario@clinica.com x-apidog-orders: - email example: email: usuario@clinica.com responses: '200': description: Magic link enviado headers: {} x-apidog-name: OK '429': description: Limite de envio excedido headers: {} x-apidog-name: Too Many Requests security: [] x-apidog-folder: Autenticação x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104942-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Dados do usuário autenticado ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /auth/v1/user: get: summary: Dados do usuário autenticado deprecated: false description: Retorna informações do usuário logado operationId: getCurrentUser tags: - Autenticação - Autenticação parameters: [] responses: '200': description: Dados do usuário content: application/json: schema: type: object properties: id: type: string format: uuid email: type: string created_at: type: string format: date-time x-apidog-orders: - id - email - created_at headers: {} x-apidog-name: OK security: - Combination: [] x-apidog: required: true schemeGroups: - id: kKVBLauHGBEJJ6qdxv_5M schemeIds: - Combination use: id: kKVBLauHGBEJJ6qdxv_5M x-apidog-folder: Autenticação x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104944-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Login com email e senha ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /auth/v1/token?grant_type=password: post: summary: Login com email e senha deprecated: false description: Autentica usuário e retorna JWT operationId: loginPassword tags: - Autenticação - Autenticação parameters: - name: grant_type in: query description: '' required: true example: password schema: type: string requestBody: content: application/json: schema: type: object required: - email - password properties: email: type: string format: email examples: - admin@mediconnect.com password: type: string format: password examples: - senha123 x-apidog-orders: - email - password example: email: hugo@popcode.com.br password: hdoria responses: '200': description: Login bem-sucedido content: application/json: schema: type: object properties: access_token: type: string token_type: type: string examples: - bearer expires_in: type: integer examples: - 3600 refresh_token: type: string user: type: object properties: id: type: string format: uuid email: type: string x-apidog-orders: - id - email x-apidog-orders: - access_token - token_type - expires_in - refresh_token - user headers: {} x-apidog-name: OK '400': description: Credenciais inválidas headers: {} x-apidog-name: Bad Request security: [] x-apidog-folder: Autenticação x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104941-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ``` # Enviar Magic Link ## OpenAPI Specification ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /auth/v1/otp: post: summary: Enviar Magic Link deprecated: false description: Envia link de autenticação sem senha por email operationId: sendMagicLink tags: - Autenticação - Autenticação parameters: [] requestBody: content: application/json: schema: type: object required: - email properties: email: type: string format: email examples: - usuario@clinica.com x-apidog-orders: - email example: email: usuario@clinica.com responses: '200': description: Magic link enviado headers: {} x-apidog-name: OK '429': description: Limite de envio excedido headers: {} x-apidog-name: Too Many Requests security: [] x-apidog-folder: Autenticação x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104942-run components: schemas: {} securitySchemes: BearerAuth: type: jwt scheme: bearer bearerFormat: JWT description: Token JWT obtido após autenticação no Supabase ApiKeyAuth: type: apikey in: header name: apikey description: >- API Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ Combination: group: - id: 411599 - id: 411600 type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - BearerAuth: [] x-apidog: schemeGroups: - id: RFxC7GDggznAKdsvxFeIw schemeIds: - BearerAuth required: true use: id: RFxC7GDggznAKdsvxFeIw scopes: RFxC7GDggznAKdsvxFeIw: BearerAuth: [] ```