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

# Update Diagram

> Update an existing database diagram

The Update Diagram endpoint allows you to modify an existing database diagram's properties.

## Authorizations

<ParamField header="Authorization" type="string" required>
  Bearer authentication header of the form `Bearer <api_key>`, where `<api_key>` is your auth token from ChartDB starts with `ch_`.
</ParamField>

## Path Parameters

<ParamField path="diagram_id" type="string" required>
  The unique identifier of the diagram.

  <Frame style={{ width: "70%" }}>
    <img src="https://mintcdn.com/buckledev/Nk8pE0k5UNFAdU1u/docs/images/api/chartdb-diagram-id.png?fit=max&auto=format&n=Nk8pE0k5UNFAdU1u&q=85&s=95d4e9d8b46b11c60ad34c50dffa75f4" width="1816" height="708" data-path="docs/images/api/chartdb-diagram-id.png" />
  </Frame>
</ParamField>

## Request Body

<ParamField body="diagram_name" type="string">
  New name for the diagram.
</ParamField>

<ParamField body="json_metadata" type="object">
  Updated diagram settings in JSON format. (See
  [Examples](/docs/api/examples/postgresql) for more information)
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.chartdb.io/api/update_diagram/123456789 \
    -H "Authorization: Bearer ch_123456789" \
    -H "Content-Type: application/json" \
    -d '{
      "diagram_name": "Updated E-commerce Diagram",
      "json_metadata": {
        "fk_info": [],
        "pk_info": [],
        "columns": [],
        "indexes": [],
        "tables": [],
        "views": [],
        "database_name": "postgres"
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "status": "success",
    "message": "Diagram updated successfully"
  }
  ```
</ResponseExample>
