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

# Update Organization Metadata

> Updates the organization metadata

## Update Organization Metadata

Updates the organization metadata and validates it against the stored schema. This endpoint requires a valid tenant API key for authentication.

### Headers

<ParamField header="Authorization" type="string" required>
  API key is required. Enter your tenant-specific API key in the format 'Bearer
  YOUR-API-KEY'
</ParamField>

### Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the organization
</ParamField>

### Body Parameters

<ParamField body="metadata" type="object" required>
  The metadata object that should match the schema stored in
  organizationMetadata
</ParamField>

### Response

<ResponseField name="id" type="string">
  The unique identifier for the metadata record
</ResponseField>

<ResponseField name="organizationId" type="string">
  The organization ID that this metadata belongs to
</ResponseField>

<ResponseField name="version" type="integer">
  The version number of the metadata record
</ResponseField>

<ResponseField name="metadata" type="object">
  The metadata object containing the custom data
</ResponseField>

<ResponseField name="createdAt" type="string" format="date-time">
  The timestamp when the metadata was created (ISO 8601 format:
  "2025-06-01T14:23:45Z")
</ResponseField>

<ResponseField name="createdBy" type="string">
  The ID of the user who created the metadata
</ResponseField>

### Example Request

```bash theme={null}
curl -X PUT https://allomia.com/api/organization/a1b2c3d4-e5f6-7890-abcd-123456789012/metadata \
  -H "Authorization: Bearer YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "metadata": {
      "specialties": ["cardiology", "neurology"],
      "emrSystem": "Epic",
      "operatingHours": {
        "monday": "9:00-17:00",
        "tuesday": "9:00-17:00",
        "wednesday": "9:00-17:00",
        "thursday": "9:00-17:00",
        "friday": "9:00-17:00"
      },
      "services": {
        "telehealth": true,
        "inPersonVisits": true,
        "emergencyCare": false
      }
    }
  }'
```

### Example Response

```json theme={null}
{
  "id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
  "organizationId": "a1b2c3d4-e5f6-7890-abcd-123456789012",
  "version": 1,
  "metadata": {
    "specialties": ["cardiology", "neurology"],
    "emrSystem": "Epic",
    "operatingHours": {
      "monday": "9:00-17:00",
      "tuesday": "9:00-17:00",
      "wednesday": "9:00-17:00",
      "thursday": "9:00-17:00",
      "friday": "9:00-17:00"
    },
    "services": {
      "telehealth": true,
      "inPersonVisits": true,
      "emergencyCare": false
    }
  },
  "createdAt": "2025-06-01T14:23:45Z",
  "createdBy": "b2c3d4e5-f6a7-8901-bcde-234567890123"
}
```

### Error Responses

<AccordionGroup>
  <Accordion title="400: Invalid metadata - Schema validation failed">
    ```json theme={null}
    {
      "error": "Schema validation failed: missing required field 'specialties'"
    }
    ```
  </Accordion>

  <Accordion title="401: Unauthorized">
    ```json theme={null}
    {
      "error": "Invalid or missing API key"
    }
    ```
  </Accordion>

  <Accordion title="404: Organization metadata not found">
    ```json theme={null}
    {
      "error": "Organization metadata not found for the provided ID"
    }
    ```
  </Accordion>

  <Accordion title="500: Error">
    ```json theme={null}
    {
      "error": "Internal server error occurred"
    }
    ```
  </Accordion>
</AccordionGroup>
