> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api-docs.nilo.services/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api-docs.nilo.services/_mcp/server.

# Cadastrar ou atualizar

POST https://landing-zone-api.nilo.services/fhir/resources/Appointment
Content-Type: application/json

Cria um agendamento ou atualiza um existente, reconhecido pelo `identifier`. Exige `start`, `end` e exatamente um participante paciente e um profissional.

Reference: https://api-docs.nilo.services/referencia/endpoints/appointment/create

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://landing-zone-api.nilo.services` (Production, default)
- `https://landing-zone-api.stg.nilo.services` (Staging)

## Request

### Body (application/json)

This endpoint expects an Appointment.

- `resourceType` (string, required, default: Appointment) — Indica o tipo do recurso transacionado.
- `identifier` (list of Identifier, required) — Suas chaves do agendamento. **Obrigatório na escrita**: é por elas que a API decide entre criar e atualizar. A leitura devolve o seu identificador ao lado do identificador Nilo, no `system` `.../NamingSystem/care-api--scheduling-v2`.
- `status` (string, required) — **Obrigatório.** Na escrita, oito valores são aceitos, mas eles colapsam em quatro situações da plataforma — veja o guia. Na leitura, o valor devolvido é o da situação, não o que você enviou.
- `participant` (list of Appointment_Participant, required) — **Obrigatório**: exatamente **um** participante de tipo `Patient` e **um** de tipo `Practitioner`. Nem zero, nem dois de cada.
- `id` (string, optional) — Só resposta: identificador Nilo FHIR do agendamento.
- `meta` (Meta, optional) — Só resposta: metadados da gravação.
- `start` (string, optional) — **Obrigatório na escrita.** Início previsto do agendamento. Na leitura pode faltar num agendamento cancelado, cujas datas a plataforma às vezes limpa.
- `end` (string, optional) — **Obrigatório na escrita**, e tem de ser maior que o `start`. Na leitura pode faltar num agendamento cancelado.
- `description` (string, optional) — O título do agendamento. Repare que é o `description` do FHIR que guarda o **título** — o texto livre vai no `comment`.
- `comment` (string, optional) — Observações do agendamento, em texto livre. **Omiti-lo numa atualização apaga a observação na plataforma, mas o recurso preserva o valor anterior** — para zerar os dois lados, mande o campo vazio.
- `appointmentType` (Appointment_AppointmentType, optional) — A modalidade do atendimento. Omitido na escrita, o agendamento nasce **online**.
- `extension` (list of AppointmentExtensionItems, optional) — Informações adicionais que não fazem parte da definição básica do recurso. Abaixo estão as extensões usadas no contexto Nilo; extensões externas a esse contexto são ignoradas.
- `created` (string, optional) — Só resposta: quando o agendamento foi criado.
- `contained` (list of Appointment_Endpoint, optional) — Só resposta, e só nos agendamentos online com sala criada: um `Endpoint` cujo `address` é o link da sala de vídeo. A sala é criada de forma assíncrona, depois da resposta do `POST`, e depende de a funcionalidade estar habilitada no seu ambiente.

## Response

### 200

Agendamento criado ou atualizado. O corpo é o recurso como ficou gravado, sem envelope.

- `resourceType` (string, required, default: Appointment) — Indica o tipo do recurso transacionado.
- `identifier` (list of Identifier, required) — Suas chaves do agendamento. **Obrigatório na escrita**: é por elas que a API decide entre criar e atualizar. A leitura devolve o seu identificador ao lado do identificador Nilo, no `system` `.../NamingSystem/care-api--scheduling-v2`.
- `status` (string, required) — **Obrigatório.** Na escrita, oito valores são aceitos, mas eles colapsam em quatro situações da plataforma — veja o guia. Na leitura, o valor devolvido é o da situação, não o que você enviou.
- `participant` (list of Appointment_Participant, required) — **Obrigatório**: exatamente **um** participante de tipo `Patient` e **um** de tipo `Practitioner`. Nem zero, nem dois de cada.
- `id` (string, optional) — Só resposta: identificador Nilo FHIR do agendamento.
- `meta` (Meta, optional) — Só resposta: metadados da gravação.
- `start` (string, optional) — **Obrigatório na escrita.** Início previsto do agendamento. Na leitura pode faltar num agendamento cancelado, cujas datas a plataforma às vezes limpa.
- `end` (string, optional) — **Obrigatório na escrita**, e tem de ser maior que o `start`. Na leitura pode faltar num agendamento cancelado.
- `description` (string, optional) — O título do agendamento. Repare que é o `description` do FHIR que guarda o **título** — o texto livre vai no `comment`.
- `comment` (string, optional) — Observações do agendamento, em texto livre. **Omiti-lo numa atualização apaga a observação na plataforma, mas o recurso preserva o valor anterior** — para zerar os dois lados, mande o campo vazio.
- `appointmentType` (Appointment_AppointmentType, optional) — A modalidade do atendimento. Omitido na escrita, o agendamento nasce **online**.
- `extension` (list of AppointmentExtensionItems, optional) — Informações adicionais que não fazem parte da definição básica do recurso. Abaixo estão as extensões usadas no contexto Nilo; extensões externas a esse contexto são ignoradas.
- `created` (string, optional) — Só resposta: quando o agendamento foi criado.
- `contained` (list of Appointment_Endpoint, optional) — Só resposta, e só nos agendamentos online com sala criada: um `Endpoint` cujo `address` é o link da sala de vídeo. A sala é criada de forma assíncrona, depois da resposta do `POST`, e depende de a funcionalidade estar habilitada no seu ambiente.

## Errors

### 400 Bad Request Error

Rejeitado. O corpo é um `OperationOutcome`; a recusa aponta o campo em `issue[].expression`.

- `issue` (list of OperationOutcomeIssueItems, required) — Uma coleção de mensagens de erro, aviso ou informação que resultado de uma ação do sistema.
- `resourceType` (string, required, default: OperationOutcome) — Indica o tipo do recurso transacionado.

## Types

### Identifier

Um identificador, código que identifica alguma entidade de forma única e inequívoca. Normalmente, isso é usado para identificadores de negócios.

- `system` (string, required) — O namespace para o valor do identificador. O cliente deve usar o seu próprio namespace.
- `value` (string, required) — O código de identificação único. Cliente deve usar o seu próprio.
- `use` (enum, optional) — A finalidade deste identificador.
  - Allowed values: `usual`, `official`, `temp`, `secondary`, `old`

### Appointment_Participant

Um participante do agendamento.

- `actor` (Appointment_Participant_Actor, required) — O paciente ou o profissional. **Obrigatório**, e o `type` é o que diz qual dos dois é.
- `status` (string, required) — Exigido pelo FHIR e **descartado na escrita**: a leitura devolve sempre `accepted`.

### Meta

Os metadados sobre um recurso. Este conteúdo do recurso é normalmente mantido pelo sistema gestor do registro.

- `lastUpdated` (string, optional) — Um instante no tempo (necessário conhecer pelo menos até o nível de segundos).
- `versionId` (string, optional) — Qualquer combinação de letras, números, "-" e ".", com um limite de 64 caracteres. (Pode ser um número inteiro, um OID não prefixado, UUID ou qualquer outro padrão de identificador que atenda a essas restrições.) Os IDs não diferenciam maiúsculas de minúsculas.

### Appointment_AppointmentType

Modalidade do atendimento.

- `coding` (list of Appointment_AppointmentType_Coding, required) — Só o primeiro item cujo `system` seja o de modalidade da Nilo é lido.

### AppointmentExtensionItems

- Extension-Appointment-allowConflict: Extension-Appointment-allowConflict

### Appointment_Endpoint

A sala de vídeo do agendamento, embutida no recurso. Só resposta.

- `resourceType` (string, optional, default: Endpoint) — Constante `Endpoint`.
- `address` (string, optional) — O link da sala de vídeo.
- `status` (enum, optional) — Constante `active`.
  - Allowed values: `active`
- `connectionType` (Coding, optional) — Constante, com `code` igual a `https`.
- `payloadType` (list of CodeableConcept, optional) — Constante, com `text` igual a `video`.

### OperationOutcomeIssueItems

Uma mensagem de erro, aviso ou informação que resultado de uma ação do sistema.

- `code` (enum, optional) — Descreve o tipo do problema.
  - Allowed values: `invalid`, `structure`, `required`, `value`, `invariant`, `security`, `login`, `unknown`, `expired`, `forbidden`, `suppressed`, `processing`, `not-supported`, `duplicate`, `multiple-matches`, `not-found`, `deleted`, `too-long`, `code-invalid`, `extension`, `too-costly`, `business-rule`, `conflict`, `transient`, `lock-error`, `no-store`, `exception`, `timeout`, `incomplete`, `throttled`, `informational`
- `details` (CodeableConcept, optional) — Detalhes adicionais sobre os códigos de resultado da operação de erro.
- `diagnostics` (string, optional) — Informações de diagnóstico adicionais sobre o problema
- `expression` (list of string, optional) — FHIR Path (caminho) do(s) elemento(s) relacionado(s) ao problema.
- `severity` (enum, optional) — Indica o resultado do processamento apesar do problema indicado.
  - Allowed values: `fatal`, `error`, `warning`, `information`

### Appointment_Participant_Actor

Referência ao paciente ou ao profissional.

- `identifier` (Identifier, required) — O identificador do participante — a sua chave ou o identificador Nilo dele.
- `type` (enum, required) — **Obrigatório na escrita**: é o que distingue o paciente do profissional.
  - Allowed values: `Patient`, `Practitioner`
- `reference` (string, optional) — Só resposta: o caminho relativo do participante.

### Appointment_AppointmentType_Coding

Código da modalidade.

- `system` (string, required) — Constante `{host}/fhir/resources/CodeSystem/appointment-type`, com o host do ambiente. Um coding em qualquer outro `system` é **ignorado em silêncio**, e a modalidade cai em online — errar esta URL faz um agendamento presencial virar online sem erro.
- `code` (string, required) — `ONLINE` ou `IN_PERSON`. Qualquer outro código no `system` da Nilo **recusa a chamada**.
- `display` (string, optional) — Só resposta: `Atendimento Online` ou `Atendimento Presencial`.

### Extension-Appointment-allowConflict

Dispensa a conferência da agenda do profissional ao gravar o agendamento. Com `true`, a plataforma deixa de recusar as três situações que confere: colisão com outro compromisso do profissional, horário fora da grade de atendimento dele, e horário já ocupado por outro agendamento do mesmo paciente ou do mesmo profissional. São dispensadas juntas — não há como liberar uma e manter as outras. O agendamento gravado com `true` também **deixa de bloquear** os agendamentos seguintes: outro agendamento no mesmo horário passa a ser aceito sem extensão nenhuma. **Omitida, vale `true`**: o horário que a integração recebe é tratado como decisão já tomada do lado de quem envia. Só um `false` explícito pede a conferência — e nem sempre a obtém: quando a configuração de sobreposição do care provider está habilitada, a plataforma continua permitindo a sobreposição, e a resposta devolve `true`. A extensão vem em **toda** leitura de `Appointment`, com `true` ou com `false`.

- `url` (string, optional, default: https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict) — Identifica o significado da extensão.
- `valueBoolean` (boolean, optional) — Valor de "verdadeiro" ou "falso".

### Coding

Código definido por um sistema de terminologia.

- `code` (string, optional) — Código de identificação de um termo no sistema terminológico.
- `display` (string, optional) — Representação textual definida pelo sistema terminológico.
- `system` (string, optional) — Identidade do sistema terminológico.

### CodeableConcept

Um CodeableConcept representa um valor geralmente fornecido como uma referência a terminologias ou ontologias, mas também pode ser definido pelo fornecimento de texto. Esse é um padrão comum em dados de saúde.

- `coding` (list of Coding, optional) — Código definido por um sistema de terminologia.
- `text` (string, optional) — Representação de texto simples do conceito.

## Examples

### Agendamento gravado

**Response**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://landing-zone-api.nilo.services/fhir/resources/NamingSystem/care-api--scheduling-v2",
      "value": "620914",
      "use": "usual"
    },
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient",
        "reference": "Patient/ba200cfa-dae0-46cf-81a0-008e3f7414b4"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner",
        "reference": "Practitioner/1f30c8b7-45ad-4e62-9c81-73b0e5f24a19"
      },
      "status": "accepted"
    }
  ],
  "id": "8f30c26b-5d17-4e94-a1c3-70b6e2854f19",
  "meta": {
    "lastUpdated": "2026-06-01T09:12:45.208000Z",
    "versionId": "MTc4NjAyMTQ1MjkwNTAwMDM2Nw"
  },
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE",
        "display": "Atendimento Online"
      }
    ]
  },
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": false
    }
  ],
  "created": "2026-06-01T09:12:44+00:00"
}
```

**SDK Code**

```python Agendamento gravado
import requests

url = "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Agendamento gravado
const url = 'https://landing-zone-api.nilo.services/fhir/resources/Appointment';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Agendamento gravado
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Agendamento gravado
require 'uri'
require 'net/http'

url = URI("https://landing-zone-api.nilo.services/fhir/resources/Appointment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Agendamento gravado
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://landing-zone-api.nilo.services/fhir/resources/Appointment")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Agendamento gravado
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://landing-zone-api.nilo.services/fhir/resources/Appointment', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Agendamento gravado
using RestSharp;

var client = new RestClient("https://landing-zone-api.nilo.services/fhir/resources/Appointment");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Agendamento gravado
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://landing-zone-api.nilo.services/fhir/resources/Appointment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Agendar uma consulta online

**Request**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      }
    ]
  }
}
```

**Response**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://landing-zone-api.nilo.services/fhir/resources/NamingSystem/care-api--scheduling-v2",
      "value": "620914",
      "use": "usual"
    },
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient",
        "reference": "Patient/ba200cfa-dae0-46cf-81a0-008e3f7414b4"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner",
        "reference": "Practitioner/1f30c8b7-45ad-4e62-9c81-73b0e5f24a19"
      },
      "status": "accepted"
    }
  ],
  "id": "8f30c26b-5d17-4e94-a1c3-70b6e2854f19",
  "meta": {
    "lastUpdated": "2026-06-01T09:12:45.208000Z",
    "versionId": "MTc4NjAyMTQ1MjkwNTAwMDM2Nw"
  },
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE",
        "display": "Atendimento Online"
      }
    ]
  },
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": false
    }
  ],
  "created": "2026-06-01T09:12:44+00:00"
}
```

**SDK Code**

```python Agendar uma consulta online
import requests

url = "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

payload = {
    "resourceType": "Appointment",
    "identifier": [
        {
            "system": "https://www.acmesaude.com.br/integracao/agendamento/",
            "value": "AG-3001",
            "use": "usual"
        }
    ],
    "status": "booked",
    "participant": [
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/paciente/",
                    "value": "507823709",
                    "use": "usual"
                },
                "type": "Patient"
            },
            "status": "accepted"
        },
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/profissional/",
                    "value": "5032932",
                    "use": "usual"
                },
                "type": "Practitioner"
            },
            "status": "accepted"
        }
    ],
    "start": "2026-06-15T14:00:00+00:00",
    "end": "2026-06-15T14:30:00+00:00",
    "description": "Consulta de retorno — endocrinologia",
    "comment": "Paciente pediu horário no fim da tarde.",
    "appointmentType": { "coding": [
            {
                "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
                "code": "ONLINE"
            }
        ] }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Agendar uma consulta online
const url = 'https://landing-zone-api.nilo.services/fhir/resources/Appointment';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"resourceType":"Appointment","identifier":[{"system":"https://www.acmesaude.com.br/integracao/agendamento/","value":"AG-3001","use":"usual"}],"status":"booked","participant":[{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/paciente/","value":"507823709","use":"usual"},"type":"Patient"},"status":"accepted"},{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/profissional/","value":"5032932","use":"usual"},"type":"Practitioner"},"status":"accepted"}],"start":"2026-06-15T14:00:00+00:00","end":"2026-06-15T14:30:00+00:00","description":"Consulta de retorno — endocrinologia","comment":"Paciente pediu horário no fim da tarde.","appointmentType":{"coding":[{"system":"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type","code":"ONLINE"}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Agendar uma consulta online
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

	payload := strings.NewReader("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Agendar uma consulta online
require 'uri'
require 'net/http'

url = URI("https://landing-zone-api.nilo.services/fhir/resources/Appointment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Agendar uma consulta online
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://landing-zone-api.nilo.services/fhir/resources/Appointment")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}")
  .asString();
```

```php Agendar uma consulta online
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://landing-zone-api.nilo.services/fhir/resources/Appointment', [
  'body' => '{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      }
    ]
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Agendar uma consulta online
using RestSharp;

var client = new RestClient("https://landing-zone-api.nilo.services/fhir/resources/Appointment");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Agendar uma consulta online
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "resourceType": "Appointment",
  "identifier": [
    [
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    ]
  ],
  "status": "booked",
  "participant": [
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        ],
        "type": "Patient"
      ],
      "status": "accepted"
    ],
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        ],
        "type": "Practitioner"
      ],
      "status": "accepted"
    ]
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": ["coding": [
      [
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      ]
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://landing-zone-api.nilo.services/fhir/resources/Appointment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Agendar uma consulta presencial

**Request**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3002",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-16T09:00:00+00:00",
  "end": "2026-06-16T09:40:00+00:00",
  "description": "Consulta inicial — nutrição",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "IN_PERSON"
      }
    ]
  }
}
```

**Response**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://landing-zone-api.nilo.services/fhir/resources/NamingSystem/care-api--scheduling-v2",
      "value": "620914",
      "use": "usual"
    },
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient",
        "reference": "Patient/ba200cfa-dae0-46cf-81a0-008e3f7414b4"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner",
        "reference": "Practitioner/1f30c8b7-45ad-4e62-9c81-73b0e5f24a19"
      },
      "status": "accepted"
    }
  ],
  "id": "8f30c26b-5d17-4e94-a1c3-70b6e2854f19",
  "meta": {
    "lastUpdated": "2026-06-01T09:12:45.208000Z",
    "versionId": "MTc4NjAyMTQ1MjkwNTAwMDM2Nw"
  },
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE",
        "display": "Atendimento Online"
      }
    ]
  },
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": false
    }
  ],
  "created": "2026-06-01T09:12:44+00:00"
}
```

**SDK Code**

```python Agendar uma consulta presencial
import requests

url = "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

payload = {
    "resourceType": "Appointment",
    "identifier": [
        {
            "system": "https://www.acmesaude.com.br/integracao/agendamento/",
            "value": "AG-3002",
            "use": "usual"
        }
    ],
    "status": "booked",
    "participant": [
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/paciente/",
                    "value": "507823709",
                    "use": "usual"
                },
                "type": "Patient"
            },
            "status": "accepted"
        },
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/profissional/",
                    "value": "5032932",
                    "use": "usual"
                },
                "type": "Practitioner"
            },
            "status": "accepted"
        }
    ],
    "start": "2026-06-16T09:00:00+00:00",
    "end": "2026-06-16T09:40:00+00:00",
    "description": "Consulta inicial — nutrição",
    "appointmentType": { "coding": [
            {
                "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
                "code": "IN_PERSON"
            }
        ] }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Agendar uma consulta presencial
const url = 'https://landing-zone-api.nilo.services/fhir/resources/Appointment';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"resourceType":"Appointment","identifier":[{"system":"https://www.acmesaude.com.br/integracao/agendamento/","value":"AG-3002","use":"usual"}],"status":"booked","participant":[{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/paciente/","value":"507823709","use":"usual"},"type":"Patient"},"status":"accepted"},{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/profissional/","value":"5032932","use":"usual"},"type":"Practitioner"},"status":"accepted"}],"start":"2026-06-16T09:00:00+00:00","end":"2026-06-16T09:40:00+00:00","description":"Consulta inicial — nutrição","appointmentType":{"coding":[{"system":"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type","code":"IN_PERSON"}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Agendar uma consulta presencial
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

	payload := strings.NewReader("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3002\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T09:00:00+00:00\",\n  \"end\": \"2026-06-16T09:40:00+00:00\",\n  \"description\": \"Consulta inicial — nutrição\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"IN_PERSON\"\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Agendar uma consulta presencial
require 'uri'
require 'net/http'

url = URI("https://landing-zone-api.nilo.services/fhir/resources/Appointment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3002\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T09:00:00+00:00\",\n  \"end\": \"2026-06-16T09:40:00+00:00\",\n  \"description\": \"Consulta inicial — nutrição\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"IN_PERSON\"\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Agendar uma consulta presencial
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://landing-zone-api.nilo.services/fhir/resources/Appointment")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3002\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T09:00:00+00:00\",\n  \"end\": \"2026-06-16T09:40:00+00:00\",\n  \"description\": \"Consulta inicial — nutrição\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"IN_PERSON\"\n      }\n    ]\n  }\n}")
  .asString();
```

```php Agendar uma consulta presencial
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://landing-zone-api.nilo.services/fhir/resources/Appointment', [
  'body' => '{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3002",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-16T09:00:00+00:00",
  "end": "2026-06-16T09:40:00+00:00",
  "description": "Consulta inicial — nutrição",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "IN_PERSON"
      }
    ]
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Agendar uma consulta presencial
using RestSharp;

var client = new RestClient("https://landing-zone-api.nilo.services/fhir/resources/Appointment");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3002\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T09:00:00+00:00\",\n  \"end\": \"2026-06-16T09:40:00+00:00\",\n  \"description\": \"Consulta inicial — nutrição\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"IN_PERSON\"\n      }\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Agendar uma consulta presencial
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "resourceType": "Appointment",
  "identifier": [
    [
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3002",
      "use": "usual"
    ]
  ],
  "status": "booked",
  "participant": [
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        ],
        "type": "Patient"
      ],
      "status": "accepted"
    ],
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        ],
        "type": "Practitioner"
      ],
      "status": "accepted"
    ]
  ],
  "start": "2026-06-16T09:00:00+00:00",
  "end": "2026-06-16T09:40:00+00:00",
  "description": "Consulta inicial — nutrição",
  "appointmentType": ["coding": [
      [
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "IN_PERSON"
      ]
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://landing-zone-api.nilo.services/fhir/resources/Appointment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Agendar permitindo sobreposição

**Request**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3003",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-16T11:00:00+00:00",
  "end": "2026-06-16T11:20:00+00:00",
  "description": "Encaixe — cardiologia",
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": true
    }
  ]
}
```

**Response**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://landing-zone-api.nilo.services/fhir/resources/NamingSystem/care-api--scheduling-v2",
      "value": "620914",
      "use": "usual"
    },
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient",
        "reference": "Patient/ba200cfa-dae0-46cf-81a0-008e3f7414b4"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner",
        "reference": "Practitioner/1f30c8b7-45ad-4e62-9c81-73b0e5f24a19"
      },
      "status": "accepted"
    }
  ],
  "id": "8f30c26b-5d17-4e94-a1c3-70b6e2854f19",
  "meta": {
    "lastUpdated": "2026-06-01T09:12:45.208000Z",
    "versionId": "MTc4NjAyMTQ1MjkwNTAwMDM2Nw"
  },
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE",
        "display": "Atendimento Online"
      }
    ]
  },
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": false
    }
  ],
  "created": "2026-06-01T09:12:44+00:00"
}
```

**SDK Code**

```python Agendar permitindo sobreposição
import requests

url = "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

payload = {
    "resourceType": "Appointment",
    "identifier": [
        {
            "system": "https://www.acmesaude.com.br/integracao/agendamento/",
            "value": "AG-3003",
            "use": "usual"
        }
    ],
    "status": "booked",
    "participant": [
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/paciente/",
                    "value": "507823709",
                    "use": "usual"
                },
                "type": "Patient"
            },
            "status": "accepted"
        },
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/profissional/",
                    "value": "5032932",
                    "use": "usual"
                },
                "type": "Practitioner"
            },
            "status": "accepted"
        }
    ],
    "start": "2026-06-16T11:00:00+00:00",
    "end": "2026-06-16T11:20:00+00:00",
    "description": "Encaixe — cardiologia",
    "extension": [
        {
            "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
            "valueBoolean": True
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Agendar permitindo sobreposição
const url = 'https://landing-zone-api.nilo.services/fhir/resources/Appointment';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"resourceType":"Appointment","identifier":[{"system":"https://www.acmesaude.com.br/integracao/agendamento/","value":"AG-3003","use":"usual"}],"status":"booked","participant":[{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/paciente/","value":"507823709","use":"usual"},"type":"Patient"},"status":"accepted"},{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/profissional/","value":"5032932","use":"usual"},"type":"Practitioner"},"status":"accepted"}],"start":"2026-06-16T11:00:00+00:00","end":"2026-06-16T11:20:00+00:00","description":"Encaixe — cardiologia","extension":[{"url":"https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict","valueBoolean":true}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Agendar permitindo sobreposição
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

	payload := strings.NewReader("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3003\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T11:00:00+00:00\",\n  \"end\": \"2026-06-16T11:20:00+00:00\",\n  \"description\": \"Encaixe — cardiologia\",\n  \"extension\": [\n    {\n      \"url\": \"https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict\",\n      \"valueBoolean\": true\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Agendar permitindo sobreposição
require 'uri'
require 'net/http'

url = URI("https://landing-zone-api.nilo.services/fhir/resources/Appointment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3003\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T11:00:00+00:00\",\n  \"end\": \"2026-06-16T11:20:00+00:00\",\n  \"description\": \"Encaixe — cardiologia\",\n  \"extension\": [\n    {\n      \"url\": \"https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict\",\n      \"valueBoolean\": true\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Agendar permitindo sobreposição
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://landing-zone-api.nilo.services/fhir/resources/Appointment")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3003\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T11:00:00+00:00\",\n  \"end\": \"2026-06-16T11:20:00+00:00\",\n  \"description\": \"Encaixe — cardiologia\",\n  \"extension\": [\n    {\n      \"url\": \"https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict\",\n      \"valueBoolean\": true\n    }\n  ]\n}")
  .asString();
```

```php Agendar permitindo sobreposição
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://landing-zone-api.nilo.services/fhir/resources/Appointment', [
  'body' => '{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3003",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-16T11:00:00+00:00",
  "end": "2026-06-16T11:20:00+00:00",
  "description": "Encaixe — cardiologia",
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": true
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Agendar permitindo sobreposição
using RestSharp;

var client = new RestClient("https://landing-zone-api.nilo.services/fhir/resources/Appointment");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3003\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"booked\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-16T11:00:00+00:00\",\n  \"end\": \"2026-06-16T11:20:00+00:00\",\n  \"description\": \"Encaixe — cardiologia\",\n  \"extension\": [\n    {\n      \"url\": \"https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict\",\n      \"valueBoolean\": true\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Agendar permitindo sobreposição
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "resourceType": "Appointment",
  "identifier": [
    [
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3003",
      "use": "usual"
    ]
  ],
  "status": "booked",
  "participant": [
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        ],
        "type": "Patient"
      ],
      "status": "accepted"
    ],
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        ],
        "type": "Practitioner"
      ],
      "status": "accepted"
    ]
  ],
  "start": "2026-06-16T11:00:00+00:00",
  "end": "2026-06-16T11:20:00+00:00",
  "description": "Encaixe — cardiologia",
  "extension": [
    [
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": true
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://landing-zone-api.nilo.services/fhir/resources/Appointment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Cancelar um agendamento

**Request**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "cancelled",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      }
    ]
  }
}
```

**Response**

```json
{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://landing-zone-api.nilo.services/fhir/resources/NamingSystem/care-api--scheduling-v2",
      "value": "620914",
      "use": "usual"
    },
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "booked",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient",
        "reference": "Patient/ba200cfa-dae0-46cf-81a0-008e3f7414b4"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner",
        "reference": "Practitioner/1f30c8b7-45ad-4e62-9c81-73b0e5f24a19"
      },
      "status": "accepted"
    }
  ],
  "id": "8f30c26b-5d17-4e94-a1c3-70b6e2854f19",
  "meta": {
    "lastUpdated": "2026-06-01T09:12:45.208000Z",
    "versionId": "MTc4NjAyMTQ1MjkwNTAwMDM2Nw"
  },
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE",
        "display": "Atendimento Online"
      }
    ]
  },
  "extension": [
    {
      "url": "https://landing-zone-api.nilo.services/fhir/resources/StructureDefinition/appointment-allowConflict",
      "valueBoolean": false
    }
  ],
  "created": "2026-06-01T09:12:44+00:00"
}
```

**SDK Code**

```python Cancelar um agendamento
import requests

url = "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

payload = {
    "resourceType": "Appointment",
    "identifier": [
        {
            "system": "https://www.acmesaude.com.br/integracao/agendamento/",
            "value": "AG-3001",
            "use": "usual"
        }
    ],
    "status": "cancelled",
    "participant": [
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/paciente/",
                    "value": "507823709",
                    "use": "usual"
                },
                "type": "Patient"
            },
            "status": "accepted"
        },
        {
            "actor": {
                "identifier": {
                    "system": "https://www.acmesaude.com.br/integracao/profissional/",
                    "value": "5032932",
                    "use": "usual"
                },
                "type": "Practitioner"
            },
            "status": "accepted"
        }
    ],
    "start": "2026-06-15T14:00:00+00:00",
    "end": "2026-06-15T14:30:00+00:00",
    "description": "Consulta de retorno — endocrinologia",
    "comment": "Paciente pediu horário no fim da tarde.",
    "appointmentType": { "coding": [
            {
                "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
                "code": "ONLINE"
            }
        ] }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Cancelar um agendamento
const url = 'https://landing-zone-api.nilo.services/fhir/resources/Appointment';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"resourceType":"Appointment","identifier":[{"system":"https://www.acmesaude.com.br/integracao/agendamento/","value":"AG-3001","use":"usual"}],"status":"cancelled","participant":[{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/paciente/","value":"507823709","use":"usual"},"type":"Patient"},"status":"accepted"},{"actor":{"identifier":{"system":"https://www.acmesaude.com.br/integracao/profissional/","value":"5032932","use":"usual"},"type":"Practitioner"},"status":"accepted"}],"start":"2026-06-15T14:00:00+00:00","end":"2026-06-15T14:30:00+00:00","description":"Consulta de retorno — endocrinologia","comment":"Paciente pediu horário no fim da tarde.","appointmentType":{"coding":[{"system":"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type","code":"ONLINE"}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Cancelar um agendamento
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://landing-zone-api.nilo.services/fhir/resources/Appointment"

	payload := strings.NewReader("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"cancelled\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Cancelar um agendamento
require 'uri'
require 'net/http'

url = URI("https://landing-zone-api.nilo.services/fhir/resources/Appointment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"cancelled\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Cancelar um agendamento
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://landing-zone-api.nilo.services/fhir/resources/Appointment")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"cancelled\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}")
  .asString();
```

```php Cancelar um agendamento
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://landing-zone-api.nilo.services/fhir/resources/Appointment', [
  'body' => '{
  "resourceType": "Appointment",
  "identifier": [
    {
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    }
  ],
  "status": "cancelled",
  "participant": [
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        },
        "type": "Patient"
      },
      "status": "accepted"
    },
    {
      "actor": {
        "identifier": {
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        },
        "type": "Practitioner"
      },
      "status": "accepted"
    }
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": {
    "coding": [
      {
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      }
    ]
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Cancelar um agendamento
using RestSharp;

var client = new RestClient("https://landing-zone-api.nilo.services/fhir/resources/Appointment");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"resourceType\": \"Appointment\",\n  \"identifier\": [\n    {\n      \"system\": \"https://www.acmesaude.com.br/integracao/agendamento/\",\n      \"value\": \"AG-3001\",\n      \"use\": \"usual\"\n    }\n  ],\n  \"status\": \"cancelled\",\n  \"participant\": [\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/paciente/\",\n          \"value\": \"507823709\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Patient\"\n      },\n      \"status\": \"accepted\"\n    },\n    {\n      \"actor\": {\n        \"identifier\": {\n          \"system\": \"https://www.acmesaude.com.br/integracao/profissional/\",\n          \"value\": \"5032932\",\n          \"use\": \"usual\"\n        },\n        \"type\": \"Practitioner\"\n      },\n      \"status\": \"accepted\"\n    }\n  ],\n  \"start\": \"2026-06-15T14:00:00+00:00\",\n  \"end\": \"2026-06-15T14:30:00+00:00\",\n  \"description\": \"Consulta de retorno — endocrinologia\",\n  \"comment\": \"Paciente pediu horário no fim da tarde.\",\n  \"appointmentType\": {\n    \"coding\": [\n      {\n        \"system\": \"https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type\",\n        \"code\": \"ONLINE\"\n      }\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Cancelar um agendamento
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "resourceType": "Appointment",
  "identifier": [
    [
      "system": "https://www.acmesaude.com.br/integracao/agendamento/",
      "value": "AG-3001",
      "use": "usual"
    ]
  ],
  "status": "cancelled",
  "participant": [
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/paciente/",
          "value": "507823709",
          "use": "usual"
        ],
        "type": "Patient"
      ],
      "status": "accepted"
    ],
    [
      "actor": [
        "identifier": [
          "system": "https://www.acmesaude.com.br/integracao/profissional/",
          "value": "5032932",
          "use": "usual"
        ],
        "type": "Practitioner"
      ],
      "status": "accepted"
    ]
  ],
  "start": "2026-06-15T14:00:00+00:00",
  "end": "2026-06-15T14:30:00+00:00",
  "description": "Consulta de retorno — endocrinologia",
  "comment": "Paciente pediu horário no fim da tarde.",
  "appointmentType": ["coding": [
      [
        "system": "https://landing-zone-api.nilo.services/fhir/resources/CodeSystem/appointment-type",
        "code": "ONLINE"
      ]
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://landing-zone-api.nilo.services/fhir/resources/Appointment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```