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

# Update Credential

> Updates a specific credential for the authenticated user

## Path Parameters

<ParamField path="id" type="string" required>
  Credential ID to update
</ParamField>

## Body Parameters

<ParamField body="data" type="object" required>
  Update data object

  <Expandable title="data properties">
    <ParamField body="name" type="string">
      Updated credential name
    </ParamField>

    <ParamField body="apiKey" type="string">
      Updated API key
    </ParamField>

    <ParamField body="baseUrl" type="string | null">
      Updated base URL for the provider
    </ParamField>

    <ParamField body="isValid" type="boolean">
      Updated validation status
    </ParamField>

    <ParamField body="dynamicFields" type="object">
      Updated dynamic fields
    </ParamField>

    <ParamField body="proxy" type="boolean">
      Updated proxy setting
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the credential was updated successfully
</ResponseField>

<ResponseField name="message" type="string">
  Success or error message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url http://localhost:3000/api/v1/credentials/cred_123abc \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "data": {
        "name": "OpenAI Production - Updated",
        "apiKey": "sk-new-key...",
        "isValid": true,
        "proxy": false
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('http://localhost:3000/api/v1/credentials/cred_123abc', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      data: {
        name: "OpenAI Production - Updated",
        apiKey: "sk-new-key...",
        isValid: true,
        proxy: false
      }
    })
  });

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

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

  url = "http://localhost:3000/api/v1/credentials/cred_123abc"
  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }
  payload = {
      "data": {
          "name": "OpenAI Production - Updated",
          "apiKey": "sk-new-key...",
          "isValid": True,
          "proxy": False
      }
  }

  response = requests.patch(url, headers=headers, json=payload)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Credential updated successfully"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "message": "Credential not found"
  }
  ```
</ResponseExample>

## Notes

* All fields in the `data` object are optional
* Only include the fields you want to update
* The credential ID cannot be changed
* Provider type cannot be modified after creation
