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

# Update Account

> This endpoint updates an account based on the provided ID.

`PATCH {{baseurl}}/accounts/{{accountId}}`

<Tabs>
  <Tab title="Staging">
    ```
       https://gw.stg.girostack.com/v1
    ```
  </Tab>

  <Tab title="Production">
    ```
       https://gw.prod.girostack.com/v1
    ```
  </Tab>
</Tabs>

<Card title="Headers">
  <ParamField body="x-giro-key" type="string" required>
    Pass your account's secret key as the value.
  </ParamField>
</Card>

<Card title="Path Params">
  <ParamField path="accountId" type="string">
    This is your account's publicId.
  </ParamField>
</Card>

<Card title="Body Params">
  <ParamField body="webhooks" type="array" />

  <ParamField body="live" type="boolean" />
</Card>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PATCH '{{API_BASE_URL}}/accounts/3bf02992-a9de-41dd-9cb1-243324567811' \
  --header 'x-giro-key: {{SECRET_KEY}}' \
  --header 'Content-Type: application/json' \
  --data '{
      "webhooks": [
          "https://dummy-webhook.example.com/hook/abcdefgh123456789"
      ]
  }'
  ```

  ```javascript Node.JS theme={null}
   const fetch = require('node-fetch');

    const url = '{{API_BASE_URL}}/accounts/3bf02992-a9de-41dd-9cb1-243324567811';
    const headers = {
      'x-giro-key': {{SECRET_KEY}},
      'Content-Type': 'application/json'
    };

    const body = JSON.stringify({
      webhooks: [
        'https://dummy-webhook.example.com/hook/abcdefgh123456789'
      ]
    });

    fetch(url, {
      method: 'PATCH',
      headers: headers,
      body: body
    })
      .then(response => response.json())
      .then(data => console.log(data))
      .catch(error => console.error('Error:', error));
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => '{{API_BASE_URL}}/accounts/3bf02992-a9de-41dd-9cb1-243324567811',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_HTTPHEADER => array(
      'x-giro-key: {{SECRET_KEY}}',
      'Content-Type: application/json'
    ),
    CURLOPT_POSTFIELDS => json_encode([
        'webhooks' => [
          'https://dummy-webhook.example.com/hook/abcdefgh123456789'
        ]
      ])
  ));

  $response = curl_exec($curl);

  if (curl_errno($curl)) {
    echo 'Error: ' . curl_error($curl);
  } else {
    echo $response;
  }

  curl_close($curl);
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
      "meta": {
          "statusCode": 200,
          "success": true,
          "message": "accounts successfully updated"
      },
      "data": {
          "_id": "650078a7325376468ec517dd",
          "publicId": "5b4ad876-fe77-48e2-bf01-6db8049b41a4",
          "name": "Giro app",
          "webhooks": [
              "https://dummy-webhook.example.com/hook/abcdefgh123456789"
          ],
          "isDefault": true,
          "pubKey": {
              "live": "live_pub_d66b499bad368792240fdc9c-7548-486e-802d-3db3cee22759",
              "test": "test_pub_66fb675d0f3b3b496498f354-33e8-499e-9a68-9801944bc9a0"
          },
          "createdAt": "2023-09-12T14:41:43.008Z",
          "updatedAt": "2023-09-12T14:41:55.056Z",
          "__v": 1,
          "business": "650078a741270245efa6781c",
          "id": "650078a7325376468ec517dd"
      }
  }
  ```

  ```json 404 Not Found theme={null}
  {
      "meta": {
          "statusCode": 404,
          "error": {
              "statusCode": 404,
              "message": "Data not found"
          }
      }
  }
  ```
</ResponseExample>
