> ## Documentation Index
> Fetch the complete documentation index at: https://docs.teamcaredental.com/llms.txt
> Use this file to discover all available pages before exploring further.

# search

If there is an inbound call, this end point will tell us whether the patient is new or existing. We can take data from patient. That data will be used further for appointmnet scheduling or finding an appointment of a patient.

### GET api/v1/ai\_voice/organizations/597/patients/search

This endpoint retrieves the patient who is calling Practice if already existing in TC database. This will be necessary for avoiding duplication of patients while scheduling an appointment. We can search the patient with fewer attributes also but data or birth and phone\_number will be mandatory. The id returned will be sent in finding appointments.

#### Parameters

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/search" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "patient": {
        "first_name": "test",
        "last_name": "patient",
        "birth_date": "1977-02-25",
        "phone_number": "1122334455"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/search?patient[first_name]=test&patient[last_name]=patient&patient[birth_date]=1977-02-25&patient[phone_number]=1122334455", {
    headers: {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN"
    }
  })

  const data = await response.json()
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/search",
      headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
      json={
        "patient": {
          "first_name": "test",
          "last_name": "patient",
          "birth_date": "1977-02-25",
          "phone_number": "1122334455"
        }
      }
  )

  data = response.json()
  ```

  ```ruby Ruby theme={null}
  require "net/http"
  require "json"

  uri = URI("https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/search")
  request = Net::HTTP::Get.new(uri)
  request["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
  request["Content-Type"] = "application/json"
  request.body = JSON.dump({
    "patient" => {
      "first_name" => "test",
      "last_name" => "patient",
      "birth_date" => "1977-02-25",
      "phone_number" => "1122334455"
    }
  })

  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end

  data = JSON.parse(response.body)
  ```
</CodeGroup>

#### Response

The response will be used for appointment scheduling etc.

* Content-Type: application/json

```json theme={null}
{
    "data": {
        "id": "2os6GZzZ",
        "type": "patient",
        "attributes": {
            "first_name": "test",
            "last_name": "01",
            "birth_date": "0001-01-01",
            "email": "test@gmail.com",
            "phone_number": "7262275678"
        }
    }
}
```
