### Available Professionals Endpoint Configuration Source: https://clinicaagil.readme.io/reference/%EF%B8%8F-configura%C3%A7%C3%B5es-espec%C3%ADficas-de-endpoints The `available_professionals` endpoint returns professionals available for scheduling based on online scheduling configurations and assigned procedures. Proper setup of professionals and procedures is crucial for accurate results. ```APIDOC ## GET available_professionals ### Description Retrieves a list of professionals available for scheduling. Availability is determined by online scheduling settings and procedure assignments. ### Method GET ### Endpoint /available_professionals ### Parameters #### Query Parameters - **date** (string) - Required - The date for which to check professional availability (YYYY-MM-DD). - **time_slot** (string) - Required - The specific time slot to check availability (e.g., '09:00'). - **procedure_id** (string) - Optional - Filter professionals available for a specific procedure. ### Request Example ```json { "date": "2023-10-27", "time_slot": "10:00", "procedure_id": "proc_abcde" } ``` ### Response #### Success Response (200) - **professionals** (array) - A list of available professionals. - **professional_id** (string) - The ID of the professional. - **name** (string) - The name of the professional. - **specialties** (array) - List of the professional's specialties. #### Response Example ```json { "professionals": [ { "professional_id": "prof_fghij", "name": "Dr. Silva", "specialties": ["Cardiologia", "Clínica Geral"] }, { "professional_id": "prof_klmno", "name": "Dra. Souza", "specialties": ["Pediatria"] } ] } ``` ``` -------------------------------- ### GET /websites/clinicaagil_readme_io/agendamentos Source: https://clinicaagil.readme.io/reference/post_get-patient-appointments Retrieves the next 30 days of patient appointments. ```APIDOC ## GET /websites/clinicaagil_readme_io/agendamentos ### Description Endpoint responsible for returning the next 30 days of patient appointments. ### Method GET ### Endpoint /websites/clinicaagil_readme_io/agendamentos ### Parameters #### Query Parameters - **data_inicio** (string) - Required - The start date for retrieving appointments (YYYY-MM-DD). - **data_fim** (string) - Required - The end date for retrieving appointments (YYYY-MM-DD). ### Request Example ``` GET /websites/clinicaagil_readme_io/agendamentos?data_inicio=2023-10-27&data_fim=2023-11-26 ``` ### Response #### Success Response (200) - **agendamentos** (array) - A list of upcoming appointments. - **id** (integer) - The unique identifier for the appointment. - **paciente_nome** (string) - The name of the patient. - **data_hora** (string) - The date and time of the appointment (YYYY-MM-DD HH:MM:SS). - **servico** (string) - The service being provided. #### Response Example ```json { "agendamentos": [ { "id": 1, "paciente_nome": "João Silva", "data_hora": "2023-10-28 10:00:00", "servico": "Consulta Geral" }, { "id": 2, "paciente_nome": "Maria Oliveira", "data_hora": "2023-10-29 14:30:00", "servico": "Exame de Sangue" } ] } ``` ``` -------------------------------- ### GET /available_professionals Source: https://clinicaagil.readme.io/reference/post_available-professionals Retrieves a list of professionals available for online scheduling based on their configurations and linked procedures. ```APIDOC ## GET /available_professionals ### Description This method returns the professionals available for scheduling, based on the online scheduling settings and the procedures each professional is linked to. ### Method GET ### Endpoint /available_professionals ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **professionals** (array) - A list of available professionals. - **id** (integer) - The unique identifier of the professional. - **name** (string) - The name of the professional. - **procedures** (array) - A list of procedures the professional is linked to. - **id** (integer) - The unique identifier of the procedure. - **name** (string) - The name of the procedure. #### Response Example ```json { "professionals": [ { "id": 1, "name": "Dr. Ana Silva", "procedures": [ { "id": 101, "name": "Consulta Geral" }, { "id": 102, "name": "Check-up" } ] }, { "id": 2, "name": "Dr. João Santos", "procedures": [ { "id": 101, "name": "Consulta Geral" }, { "id": 103, "name": "Avaliação Nutricional" } ] } ] } ``` ``` -------------------------------- ### Get Patient Treatments API Source: https://clinicaagil.readme.io/reference/endpoints-vis%C3%A3o-geral Retrieves treatments for a patient that still have available sessions. ```APIDOC ## GET /get_patient_treatments ### Description Retrieves treatments for a patient that still have available sessions. ### Method GET ### Endpoint /get_patient_treatments ### Parameters #### Path Parameters None #### Query Parameters - **patient_id** (string) - Required - The ID of the patient. ### Request Example ``` GET /get_patient_treatments?patient_id=PAT789 ``` ### Response #### Success Response (200) - **treatments** (array) - A list of the patient's treatments with available sessions. #### Response Example ```json { "treatments": [ { "treatment_id": "TREAT001", "name": "Physical Therapy", "sessions_remaining": 5 } ] } ``` ``` -------------------------------- ### Get Patient Appointments OpenAPI Definition (JSON) Source: https://clinicaagil.readme.io/reference/post_get-patient-appointments This JSON snippet defines the OpenAPI 3.0.4 specification for the CLINICA AGIL API. It details the '/get_patient_appointments' POST endpoint, including required headers (X-API-KEY, X-API-METHOD), request body schema (multipart/form-data with numero_paciente and cpf_paciente), and response schemas for successful retrieval (200) and error conditions (400, 401). ```json { "openapi": "3.0.4", "info": { "title": "CLINICA AGIL", "version": "1.0.0" }, "paths": { "/get_patient_appointments": { "post": { "summary": "Retornar agendamentos", "description": "Endpoint responsável por retornar os próximos 30 dias de agendamentos do paciente.", "parameters": [ { "name": "X-API-KEY", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave da API do cliente" }, { "name": "X-API-METHOD", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave de autorização da API" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "numero_paciente": { "type": "integer", "example": 47998765432, "description": "Informe o número de telefone do paciente" }, "cpf_paciente": { "type": "integer", "example": 52754988025, "description": "Informe o CPF do paciente" } }, "required": [ "numero_paciente", "cpf_paciente" ] } } } }, "responses": { "200": { "description": "Lista de agendamentos do paciente", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": "123" }, "data_agendamento": { "type": "string", "example": "25/04/2025" }, "hora_inicio": { "type": "string", "example": "14:00:00" }, "hora_fim": { "type": "string", "example": "15:00:00" }, "profissional_nome": { "type": "string", "example": "Gustavo" }, "procedimento_nome": { "type": "string", "example": "Consulta Geral" } } } } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Unauthorized: Invalid or missing Authorization header" }, "message": { "type": "string", "example": "Campos obrigatórios faltando." }, "campos_faltando": { "type": "array", "items": { "type": "string", "example": "numero_paciente" } } } } } } }, "401": { "description": "Unauthorized: Invalid or missing Authorization header", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Unauthorized: Invalid or missing Authorization header" }, "status": { "type": "string", "example": "error" } } } } } } }, "security": [ { "api_key": [] } ] } } } } ``` -------------------------------- ### Get Patient Treatments Endpoint Definition (OpenAPI) Source: https://clinicaagil.readme.io/reference/post_get-patient-treatments This OpenAPI 3.0.4 definition describes the '/get_patient_treatments' POST endpoint. It requires specific headers (X-API-KEY, X-API-METHOD) and a multipart/form-data request body containing patient identification (numero_paciente, cpf_paciente). The endpoint returns a list of treatments with remaining sessions or error messages for various scenarios. ```json { "openapi": "3.0.4", "info": { "title": "CLINICA AGIL", "version": "1.0.0" }, "paths": { "/get_patient_treatments": { "post": { "summary": "Retornar tratamentos do paciente", "description": "Retorna todos os tratamentos associados a um paciente específico que ainda possuem sessões restantes.", "parameters": [ { "name": "X-API-KEY", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave da API do cliente" }, { "name": "X-API-METHOD", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave de autorização da API" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "numero_paciente": { "type": "integer", "example": 47998765432, "description": "Informe o número de telefone do paciente" }, "cpf_paciente": { "type": "integer", "example": 52754988025, "description": "Informe o CPF do paciente" } }, "required": [ "numero_paciente", "cpf_paciente" ] } } } }, "responses": { "200": { "description": "Lista de tratamentos do paciente", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": "123" }, "sessoes_restantes": { "type": "integer", "example": "3" }, "especialidade": { "type": "string", "example": "Psicologia" }, "profissional": { "type": "string", "example": "Gustavo" }, "procedimentos": { "type": "string", "example": "Sessão de Psicoterapia" } } } } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "error" }, "message": { "type": "string", "example": "No patient found with the provided information" } } } } } }, "401": { "description": "Unauthorized: Invalid or missing Authorization header", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "error" }, "error": { "type": "string", "example": "Unauthorized: Invalid or missing Authorization header" } } } } } }, "501": { "description": "Internal error", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "error" }, "error": { "type": "string" } } } } } } } } } } } ``` -------------------------------- ### POST /available_professionals Source: https://clinicaagil.readme.io/reference/post_available-professionals This method retrieves available professionals for scheduling based on online scheduling settings and the procedures each professional is linked to. ```APIDOC ## POST /available_professionals ### Description This method retrieves available professionals for scheduling based on online scheduling settings and the procedures each professional is linked to. ### Method POST ### Endpoint /available_professionals ### Parameters #### Header Parameters - **X-API-KEY** (string) - Required - Client API Key - **X-API-METHOD** (string) - Required - API Authorization Key #### Request Body - **clinica_id** (integer) - Optional - Use the default value 1. If using multi-clinic mode, adjust as needed. Example: 1 - **dia** (string) - Required - The date for which to find available professionals. Example: "07/05/2025" - **procedimento_id** (integer) - Required - The ID of the procedure. Example: 101 ### Request Example ```json { "clinica_id": 1, "dia": "07/05/2025", "procedimento_id": 101 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request, e.g., "success". - **data** (array) - An array of available professionals. - **id** (integer) - The unique identifier of the professional. - **nome** (string) - The name of the professional. - **intervalo** (string) - The standard appointment interval for the professional (e.g., "01:00:00"). - **hora_inicio_agenda** (string) - The start time of the professional's schedule (e.g., "08:00:00"). - **hora_fim_agenda** (string) - The end time of the professional's schedule (e.g., "19:00:00"). - **limite_agendamentos** (string) - The limit of appointments allowed (e.g., "1"). - **horarios_matutino** (array) - A list of available morning time slots. - **inicio** (string) - The start time of the morning slot (e.g., "08:00"). - **fim** (string) - The end time of the morning slot (e.g., "08:30"). - **horarios_vespertino** (array) - A list of available afternoon time slots. - **inicio** (string) - The start time of the afternoon slot (e.g., "14:00"). - **fim** (string) - The end time of the afternoon slot (e.g., "14:30"). - **horarios_noturno** (array) - A list of available evening time slots. - **inicio** (string) - The start time of the evening slot. - **fim** (string) - The end time of the evening slot. #### Response Example ```json { "status": "success", "data": [ { "id": 135, "nome": "Gustavo", "intervalo": "01:00:00", "hora_inicio_agenda": "08:00:00", "hora_fim_agenda": "19:00:00", "limite_agendamentos": "1", "horarios_matutino": [ { "inicio": "08:00", "fim": "08:30" } ], "horarios_vespertino": [ { "inicio": "14:00", "fim": "14:30" } ], "horarios_noturno": [ { "inicio": "18:00", "fim": "18:30" } ] } ] } ``` ``` -------------------------------- ### API Authentication Headers Source: https://clinicaagil.readme.io/reference/seguran%C3%A7a The API employs a two-key authentication system. Both X-API-METHOD and X-API-KEY headers are mandatory for all requests. X-API-METHOD is specific to each endpoint, while X-API-KEY is a general service access key. ```APIDOC ## API Authentication ### Description The API uses a two-key authentication system to ensure secure access to its endpoints. Both `X-API-METHOD` and `X-API-KEY` headers must be included in every request. ### Method All HTTP methods (GET, POST, PUT, DELETE, etc.) ### Endpoint All API endpoints ### Parameters #### Header Parameters - **X-API-METHOD** (string) - Required - A specific authorization key for each API endpoint. - **X-API-KEY** (string) - Required - A general key generated upon enabling the integration service, acting as a second layer of security. ### Request Example ```json { "X-API-METHOD": "Ch4tB0tW4tsS4v3QRc0d3", "X-API-KEY": "YOUR_GENERATED_X_API_KEY" } ``` ### Response #### Error Response (401 Unauthorized) - **message** (string) - Indicates that authentication failed due to missing or invalid keys. #### Response Example ```json { "message": "Authentication failed. Please provide valid X-API-METHOD and X-API-KEY headers." } ``` ### X-API-METHOD Key Examples - `patient_data`: 'Ch4tB0tW4tsS4v3QRc0d3' - `clinic_data`: 'Ch4tB0tMK4tsQ4v3QRc0d3' - `insurance_data`: 'Ch4tB0tP4tsQ4v3Q32c0d3' - `procedures_by_insurance`: 'Ch4tB0tW4tsPpr0cs' - `available_dates`: 'Ch4tB0tW4tsd4ttt@s' - `available_professionals`: 'Ch4tB0tW4tspPr0of33' - `register_appointment`: 'Ch4tB0tW4tsa4g3nDD' - `register_paciente`: 'Ch4tB0tW4tsa4g3nDD2' - `get_patient_appointments`: 'Ch4tB0tW4tsa4g4lyT9' - `uncheck_appointment`: 'Ch4tB0tW4tsa4g7nTT9' - `get_patient_treatments`: 'Ch4tB0tW4tsamn92TT9' ``` -------------------------------- ### POST /register_appointment Source: https://clinicaagil.readme.io/reference/post_register-appointment Endpoint to register a new session appointment. It supports registering new patients or using existing ones if a `paciente_id` is provided. The `procedimento_id` and `profissional_id` become optional if `tratamento_id` is supplied. ```APIDOC ## POST /register_appointment ### Description Endpoint responsible for registering a new session appointment. If a `paciente_id` is provided, the patient's data will be retrieved for the appointment. Otherwise, the patient's name and phone number must be supplied for them to be registered first. Important: The `procedimento_id` and `profissional_id` fields are no longer mandatory if `tratamento_id` is provided. ### Method POST ### Endpoint /register_appointment ### Parameters #### Header Parameters - **X-API-KEY** (string) - Required - API key of the client - **X-API-METHOD** (string) - Required - Authorization key of the API #### Request Body - **clinica_id** (integer) - Required - Use the default value 1. Adjust if using multi-clinic mode. - **paciente_id** (integer) - Optional - ID of an existing patient. - **paciente_nome** (string) - Required (if paciente_id is not provided) - Name of the patient. - **paciente_cpf** (string) - Optional - CPF of the patient. - **paciente_telefone** (string) - Required (if paciente_id is not provided) - Phone number of the patient. - **convenio_id** (integer) - Required - ID of the health insurance. - **procedimento_id** (integer) - Optional - ID of the procedure. - **data** (string) - Required - Appointment date in DD/MM/YYYY format. - **horario** (string) - Required - Appointment time, e.g., "16:00 ás 17:00". - **profissional_id** (integer) - Optional - ID of the professional. - **tratamento_id** (integer) - Optional - ID of the treatment. If provided, `clinica_id`, `especialidade`, `profissional_id`, and `procedimento_id` associated with the treatment will be used. ### Request Example ```json { "clinica_id": 1, "paciente_nome": "João da Silva", "paciente_telefone": "5511999999999", "convenio_id": 2, "procedimento_id": 36, "data": "22/04/2025", "horario": "16:00 ás 17:00", "profissional_id": 117 } ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the operation was successful. - **paciente_id** (integer) - The ID of the patient. #### Response Example ```json { "status": true, "paciente_id": 251 } ``` #### Conflict Response (202) - Patient already has an appointment on the same day - **status** (string) - Message indicating the conflict. #### Response Example ```json { "status": "Paciente já possui um agendamento no mesmo dia." } ``` #### Error Response (401) - Unauthorized - Description: Invalid or missing Authorization header. - Content: application/json ``` -------------------------------- ### Get Patient Appointments API Source: https://clinicaagil.readme.io/reference/endpoints-vis%C3%A3o-geral Retrieves future appointments for a specific patient within the next 30 days. ```APIDOC ## GET /get_patient_appointment ### Description Retrieves future appointments for a specific patient, considering the next 30 days. ### Method GET ### Endpoint /get_patient_appointment ### Parameters #### Path Parameters None #### Query Parameters - **patient_id** (string) - Required - The ID of the patient. ### Request Example ``` GET /get_patient_appointment?patient_id=PAT789 ``` ### Response #### Success Response (200) - **appointments** (array) - A list of the patient's future appointments. #### Response Example ```json { "appointments": [ { "id": "APPT987", "datetime": "2023-11-15T10:00:00Z", "professional_name": "Dr. Smith" } ] } ``` ``` -------------------------------- ### POST /agendamentos Source: https://clinicaagil.readme.io/reference/post_register-appointment Endpoint responsible for registering a new session appointment. If a patient_id is provided, the existing patient's data will be used. Otherwise, patient name and phone are required for new registration. Procedure and professional IDs are optional if treatment ID is provided. ```APIDOC ## POST /agendamentos ### Description Endpoint responsible for registering a new session appointment. If a patient_id is provided, the existing patient's data will be used. Otherwise, patient name and phone are required for new registration. Procedure and professional IDs are optional if treatment ID is provided. ### Method POST ### Endpoint /agendamentos ### Parameters #### Request Body - **paciente_id** (integer) - Optional - ID of the patient if already registered. - **nome** (string) - Optional - Name of the patient if not registered. - **telefone** (string) - Optional - Phone number of the patient if not registered. - **procedimento_id** (integer) - Optional - ID of the procedure. - **profissional_id** (integer) - Optional - ID of the professional. - **tratamento_id** (integer) - Optional - ID of the treatment. If provided, `procedimento_id` and `profissional_id` become optional. - **data_hora** (string) - Required - Date and time of the appointment in ISO format (e.g., "YYYY-MM-DDTHH:MM:SS"). ### Request Example ```json { "paciente_id": 123, "tratamento_id": 456, "data_hora": "2023-10-27T10:00:00" } ``` ### Response #### Success Response (201) - **id** (integer) - The ID of the newly created appointment. - **paciente_id** (integer) - The ID of the patient associated with the appointment. - **procedimento_id** (integer) - The ID of the procedure. - **profissional_id** (integer) - The ID of the professional. - **tratamento_id** (integer) - The ID of the treatment. - **data_hora** (string) - The date and time of the appointment. #### Response Example ```json { "id": 789, "paciente_id": 123, "procedimento_id": null, "profissional_id": null, "tratamento_id": 456, "data_hora": "2023-10-27T10:00:00" } ``` ``` -------------------------------- ### Available Professionals API Source: https://clinicaagil.readme.io/reference/endpoints-vis%C3%A3o-geral Retrieves professionals available for scheduling based on online configurations and assigned procedures. ```APIDOC ## POST /available_professionals_post ### Description Retrieves professionals available for scheduling based on online configurations and procedures assigned to each professional. ### Method POST ### Endpoint /available_professionals_post ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **procedure_id** (string) - Required - The ID of the procedure to find available professionals for. ### Request Example ```json { "procedure_id": "PROC001" } ``` ### Response #### Success Response (200) - **professionals** (array) - A list of available professionals. #### Response Example ```json { "professionals": [ { "id": "PROF101", "name": "Dr. Smith" } ] } ``` ``` -------------------------------- ### Register Appointment Endpoint - OpenAPI Definition Source: https://clinicaagil.readme.io/reference/post_register-appointment Defines the POST endpoint for registering new appointments. It specifies request headers, request body parameters (including patient details, appointment date/time, and optional treatment ID), and possible responses (success, conflict, unauthorized). ```json { "openapi": "3.0.4", "info": { "title": "CLINICA AGIL", "version": "1.0.0" }, "paths": { "/register_appointment": { "post": { "summary": "Registrar um novo agendamento", "description": "Endpoint responsável por registrar um novo agendamento de sessão. Se um paciente_id for informado, os dados do paciente já cadastrado serão recuperados para efetuar o agendamento. Caso contrário, será necessário fornecer o nome e o telefone do paciente para que ele seja cadastrado antes da realização do agendamento. \n\n Importante: Os campos procedimento_id e profissional_id deixam de ser obrigatórios caso o tratamento_id seja fornecido.", "parameters": [ { "name": "X-API-KEY", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave da API do cliente" }, { "name": "X-API-METHOD", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave de autorização da API" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "clinica_id": { "type": "integer", "example": 1, "description": "Utilize o valor padrão 1. Se estiver utilizando o modo multi-clínicas, ajuste conforme necessário." }, "paciente_id": { "type": "integer", "example": 10 }, "paciente_nome": { "type": "string", "example": "João da Silva" }, "paciente_cpf": { "type": "string", "example": "12345678900" }, "paciente_telefone": { "type": "string", "example": "5511999999999" }, "convenio_id": { "type": "integer", "example": 2 }, "procedimento_id": { "type": "integer", "example": 36 }, "data": { "type": "string", "format": "string", "example": "22/04/2025" }, "horario": { "type": "string", "example": "16:00 ás 17:00" }, "profissional_id": { "type": "integer", "example": 117 }, "tratamento_id": { "type": "integer", "example": 1183, "description": "Opcional: Informe o ID do tratamento se o agendamento fizer parte de um tratamento existente. ID do tratamento é retornado do endpoint /get_patient_treatments. Ao preencher esse campo, o sistema usará os dados: clinica, especialidade, profissional e procedimento vinculados ao tratamento." } }, "required": [ "convenio_id", "paciente_nome", "paciente_telefone", "data", "horario", "clinica_id" ] } } } }, "responses": { "200": { "description": "Agendamento realizado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "paciente_id": { "type": "integer", "example": 251 } } } } } }, "202": { "description": "Paciente já possui agendamento no mesmo dia", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "Paciente já possui um agendamento no mesmo dia." } } } } } }, "401": { "description": "Unauthorized: Invalid or missing Authorization header", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "Unauthorized" } } } } } } } } } } } ``` -------------------------------- ### Procedures by Insurance Endpoint Configuration Source: https://clinicaagil.readme.io/reference/%EF%B8%8F-configura%C3%A7%C3%B5es-espec%C3%ADficas-de-endpoints Ensures the `procedures_by_insurance` endpoint returns correct information by requiring procedures to be configured within the online scheduling system, specifically in the 'Select the procedures each professional attends' field. Procedures must be assigned to the appropriate professionals. ```APIDOC ## GET procedures_by_insurance ### Description Retrieves insurance-related procedure information. Requires procedures to be configured in the online scheduling system and assigned to professionals. ### Method GET ### Endpoint /procedures_by_insurance ### Parameters #### Query Parameters - **insurance_id** (string) - Required - The ID of the insurance to filter procedures by. ### Request Example ```json { "insurance_id": "ins_12345" } ``` ### Response #### Success Response (200) - **procedures** (array) - A list of procedures associated with the given insurance. - **procedure_id** (string) - The ID of the procedure. - **name** (string) - The name of the procedure. - **professionals** (array) - A list of professionals who attend this procedure. - **professional_id** (string) - The ID of the professional. - **name** (string) - The name of the professional. #### Response Example ```json { "procedures": [ { "procedure_id": "proc_abcde", "name": "Consulta Geral", "professionals": [ { "professional_id": "prof_fghij", "name": "Dr. Silva" } ] } ] } ``` ``` -------------------------------- ### Register Patient OpenAPI Definition Source: https://clinicaagil.readme.io/reference/post_register-paciente This OpenAPI 3.0.4 definition describes the endpoint for registering a new patient. It specifies the request method (POST), required headers (X-API-KEY, X-API-METHOD), request body format (multipart/form-data) with patient details, and possible responses including success, conflict, and error codes. ```json { "openapi": "3.0.4", "info": { "title": "CLINICA AGIL", "version": "1.0.0" }, "paths": { "/register_paciente": { "post": { "summary": "Registrar um novo paciente", "description": "Endpoint responsável por registrar um novo paciente.", "parameters": [ { "name": "X-API-KEY", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave da API do cliente" }, { "name": "X-API-METHOD", "in": "header", "required": true, "schema": { "type": "string" }, "description": "Chave de autorização da API" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "clinica_id": { "type": "integer", "example": 1, "description": "Utilize o valor padrão 1. Se estiver utilizando o modo multi-clínicas, ajuste conforme necessário." }, "paciente_nome": { "type": "string", "example": "João da Silva" }, "paciente_cpf": { "type": "string", "example": "12345678900" }, "paciente_telefone": { "type": "string", "example": "5511999999999" }, "convenio_id": { "type": "integer", "example": 2 } }, "required": [ "convenio_id", "paciente_nome", "paciente_telefone", "procedimento_id", "data", "horario", "profissional_id", "clinica_id" ] } } } }, "responses": { "200": { "description": "Registrado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "paciente_id": { "type": "integer", "example": 251 } } } } } }, "202": { "description": "Paciente já existe", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "Paciente já possui um agendamento no mesmo dia." } } } } } }, "401": { "description": "Unauthorized: Invalid or missing Authorization header", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Unauthorized: Invalid or missing Authorization header" }, "status": { "type": "string", "example": "error" } } } } } }, "500": { "description": "Limite de agendamentos para o profissional", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "error" } } } } } } }, "security": [ { "ApiKeyAuth": [] } ] } } }, "servers": [ { "url": "https://app2.clinicaagil.com.br/api/integration/" } ], "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } } } ``` -------------------------------- ### Available Dates API Source: https://clinicaagil.readme.io/reference/endpoints-vis%C3%A3o-geral Retrieves available dates for appointments. Defaults to the current date if no specific date is provided. ```APIDOC ## POST /available_dates_post ### Description Retrieves available dates for scheduling appointments. If no date is specified, it defaults to the current date and returns options starting 7 days from then. ### Method POST ### Endpoint /available_dates_post ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **reference_date** (string) - Optional - The reference date (YYYY-MM-DD) to find available dates from. ### Request Example ```json { "reference_date": "2023-10-27" } ``` ### Response #### Success Response (200) - **available_dates** (array) - A list of available dates. #### Response Example ```json { "available_dates": [ "2023-11-03", "2023-11-04", "2023-11-05" ] } ``` ``` -------------------------------- ### Appointment Scheduling API Source: https://clinicaagil.readme.io/reference/post_available-professionals This section details the API endpoint for scheduling appointments, including request parameters and response formats. It also covers error handling for unauthorized access. ```APIDOC ## POST /appointments ### Description Schedules a new appointment. Requires authentication via an API key. ### Method POST ### Endpoint /appointments ### Parameters #### Query Parameters None #### Request Body - **patient_id** (string) - Required - The ID of the patient for whom the appointment is being scheduled. - **doctor_id** (string) - Required - The ID of the doctor for the appointment. - **date** (string) - Required - The date of the appointment in YYYY-MM-DD format. - **time** (string) - Required - The time of the appointment in HH:MM format. - **duration_minutes** (integer) - Optional - The duration of the appointment in minutes. - **notes** (string) - Optional - Additional notes for the appointment. ### Request Example ```json { "patient_id": "pat_123", "doctor_id": "doc_456", "date": "2023-10-27", "time": "10:00", "duration_minutes": 30, "notes": "Follow-up appointment" } ``` ### Response #### Success Response (200) - **appointment_id** (string) - The ID of the newly created appointment. - **status** (string) - The status of the appointment (e.g., "scheduled"). #### Response Example ```json { "appointment_id": "app_789", "status": "scheduled" } ``` #### Error Response (401) - **status** (string) - "error" - **error** (string) - "Unauthorized: Invalid or missing Authorization header" ### Security Requires an `X-API-KEY` in the request header. ```