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

# Update Datasource

> This endpoint updates the details of an existing Datasource by its ID.

### Auth Headers

<ParamField required header="x-metal-api-key" type="string">
  An API key for your org.
</ParamField>

<ParamField required header="x-metal-client-id" type="string">
  A Client ID for your org.
</ParamField>

### Params

<ParamField required path="id" type="string">
  The unique identifier of the Datasource you wish to update.
</ParamField>

### Body

<ParamField body="name" type="string">
  Updated name of the Datasource.
</ParamField>

<ParamField body="metadataFields" type="array">
  An array of updated metadata fields, each having a name, type, and description.
</ParamField>

<ParamField body="sourcetype" type="string">
  Updated type of the Datasource.
</ParamField>

<ParamField body="autoExtract" type="boolean">
  Updated flag indicating whether auto-extraction is enabled or not.
</ParamField>

<RequestExample>
  ```bash theme={null}
  # Example Request
  curl -X PUT "https://api.getmetal.io/v1/datasources/{id}" \
  --header 'Content-Type: application/json' \
  --header 'x-metal-api-key: <api-key>' \
  --header 'x-metal-client-id: <client-id>' \
  --data-raw '{
    "name": "updated_datasource",
    "metadataFields": [
      {
        "name": "updated_field",
        "type": "string",
        "description": "Updated description"
      }
    ],
    "sourcetype": "updated_type",
    "autoExtract": false
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": {
      "id": "datasourceID",
      "name": "updated_datasource",
      "metadataFields": [
        {
          "name": "updated_field",
          "type": "string",
          "description": "Updated description"
        }
      ],
      "sourcetype": "updated_type",
      "autoExtract": false,
      "updatedAt": "2023-03-17T17:21:13.163Z"
    }
  }
  ```
</ResponseExample>
