# Update a patient

> Updates the fields you send and leaves the rest unchanged. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby.

Source: https://www.bloomtext.com/developers/api/reference/update-patient/

`PATCH /patients/{patientId}`

Updates the fields you send and leaves the rest unchanged.

**Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) or an [org admin’s OAuth token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write`

### Path parameters

- `patientId` (UUID, required): ID of the patient.

### Body parameters

Only the fields you send change. Send null to clear a field.

- `first_name` (string): First name.

- `last_name` (string): Last name.

- `date_of_birth` (date or null): Date of birth.

- `phone` (string or null): Mobile number.

- `email` (string or null): Email address.

- `mrn` (string or null): The patient's ID in your system.

### Returns

Returns `200 OK` with the [Patient object](https://www.bloomtext.com/developers/api/reference/patient-object/).

### Errors

Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint:

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | The request is malformed, such as invalid JSON. |
| 401 | `invalid_token` | The API key or access token is missing, expired, or revoked. |
| 403 | `insufficient_scope` | The credential doesn’t have the scope this endpoint needs. |
| 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. |
| 422 | `validation_failed` | A field failed validation. See `field_errors`. |
| 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. |

```bash filename="Request"
curl -X PATCH "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" \
  -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+15125550177"}'
```

```js filename="Request"
const response = await fetch('https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"phone":"+15125550177"}),
})

if (!response.ok) throw new Error(`BloomText API error: ${response.status}`)
const data = await response.json()
```

```python filename="Request"
import os

import requests

response = requests.patch(
    "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77",
    headers={
        "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}",
    },
    json={"phone":"+15125550177"},
)
response.raise_for_status()
data = response.json()
```

```go filename="Request"
package main

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

func main() {
	body := bytes.NewBufferString(`{"phone":"+15125550177"}`)
	req, err := http.NewRequest("PATCH", "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.Status, string(out))
}
```

```ruby filename="Request"
require "net/http"
require "json"

uri = URI("https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77")
request = Net::HTTP::Patch.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}"
request["Content-Type"] = "application/json"
request.body = { phone: "+15125550177" }.to_json

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

```json filename="Response · 200 OK"
{
  "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77",
  "first_name": "Jane",
  "last_name": "Doe",
  "date_of_birth": "1986-04-12",
  "phone": "+15125550177",
  "email": "jane.doe@example.com",
  "mrn": "MRN-20931",
  "sms_opted_out": false,
  "conversation_count": 2,
  "created_at": "2026-02-03T17:22:10Z",
  "matched_by": null
}
```
