# Create or update an encounter

```
POST 
/encounters
```

Create or update an encounter with the provided details and returns an url to access Nabla. Navigating to this URL will log in the provider into Nabla automatically, and open the app on this encounter.

## Request[​](#request "Direct link to request")

## Responses[​](#responses "Direct link to Responses")

* 200

The encounter URL.

## Operation spec

```json
{
  "method": "post",
  "path": "/encounters",
  "operationId": "create-or-update-encounters",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "description": "Input data required to create a new encounter, IDs should be the ones from your EHR system.",
          "properties": {
            "provider_email": {
              "type": "string"
            },
            "external_patient_id": {
              "type": "string"
            },
            "external_encounter_id": {
              "type": "string"
            },
            "external_provider_id": {
              "type": "string"
            },
            "target_origin": {
              "type": "string"
            },
            "unstructured_context": {
              "type": "string",
              "description": "Some unstructured contextual information that will be used to generate the note (for example name, gender, age, pronouns, medical history). Generating the encounter note will take longer if you pass a long `unstructured_context`.",
              "maxLength": 10000
            },
            "structured_context": {
              "type": "object",
              "description": "Structured context about the patient and the encounter, which will be taken into account when generating the note.",
              "properties": {
                "patient_demographics": {
                  "type": "object",
                  "description": "Demographic details about the patient.",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The patient's name."
                    },
                    "birth_date": {
                      "type": "string",
                      "format": "date",
                      "description": "The patient's birthdate (YYYY-MM-DD format).",
                      "example": "1996-03-21"
                    },
                    "gender": {
                      "type": "string",
                      "enum": [
                        "MALE",
                        "FEMALE",
                        "OTHER",
                        "UNKNOWN"
                      ],
                      "description": "The patient's gender.",
                      "title": "gender"
                    },
                    "pronouns": {
                      "type": "string",
                      "enum": [
                        "HE_HIM",
                        "SHE_HER",
                        "THEY_THEM"
                      ],
                      "description": "The patient's pronouns.",
                      "title": "pronouns"
                    }
                  },
                  "required": [
                    "name",
                    "birth_date",
                    "gender"
                  ],
                  "title": "patient_demographics"
                }
              },
              "required": [
                "patient_demographics"
              ],
              "title": "structured_context_request"
            }
          },
          "required": [
            "provider_email",
            "external_patient_id",
            "external_encounter_id",
            "external_provider_id",
            "structured_context"
          ],
          "title": "create_or_update_encounter_request"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "The encounter URL.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "description": "The encounter URL response.",
            "properties": {
              "encounter_url": {
                "type": "string",
                "description": "URL to open the created encounter."
              }
            },
            "title": "encounter_url_response"
          }
        }
      }
    }
  }
}
```
