# Update an authorization

To [update](https://docs.commercelayer.io/core/updating-resources) an existing authorization, send a `PATCH` request to the `/api/authorizations/:id` endpoint, where `id` is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

## Request

**PATCH** <https://yourdomain.commercelayer.io/api/authorizations/:id>

### Arguments

| Body Parameter                          | Type      | Required |
| --------------------------------------- | --------- | -------- |
| **type**                                | `string`  | Required |
| **id**                                  | `string`  | Required |
| attributes.**succeeded**                | `boolean` | Optional |
| attributes.**\_forward**                | `boolean` | Optional |
| attributes.**reference**                | `string`  | Optional |
| attributes.**reference\_origin**        | `string`  | Optional |
| attributes.**metadata**                 | `object`  | Optional |
| attributes.**\_capture**                | `boolean` | Optional |
| attributes.**\_capture\_amount\_cents** | `integer` | Optional |
| attributes.**\_void**                   | `boolean` | Optional |
| attributes.**\_cancel**                 | `boolean` | Optional |

### Example

{% tabs %}
{% tab title="Request" %}
The following request updates the authorization identified by the ID "XAyRWNUzyN":

```shell
curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "authorizations",
    "id": "xYZkjABcde",
    "attributes": {
      "_capture": true,
      "_capture_amount_cents": 500
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning the updated resource object:

```json
{
  "data": {
    "id": "XAyRWNUzyN",
    "type": "authorizations",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN"
    },
    "attributes": {
      "number": "42/T/001",
      "type": "authorizations",
      "payment_method_type": "credit card",
      "currency_code": "EUR",
      "amount_cents": 1500,
      "amount_float": 15.0,
      "formatted_amount": "€15,00",
      "succeeded": false,
      "message": "Accepted",
      "error_code": "00001",
      "error_detail": "Already settled",
      "token": "xxxx-yyyy-zzzz",
      "gateway_transaction_id": "xxxx-yyyy-zzzz",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANY-EXTERNAL-REFEFERNCE",
      "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
      "metadata": {
        "foo": "bar"
      },
      "cvv_code": "000",
      "cvv_message": "validated",
      "avs_code": "000",
      "avs_message": "validated",
      "fraud_review": "passed",
      "capture_amount_cents": 500,
      "capture_amount_float": 5.0,
      "formatted_capture_amount": "€5,00",
      "capture_balance_cents": 1000,
      "capture_balance_float": 10.0,
      "formatted_capture_balance": "€10,00",
      "void_balance_cents": 1500,
      "void_balance_float": 15.0,
      "formatted_void_balance": "€15,00"
    },
    "relationships": {
      "order": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/order",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/order"
        }
      },
      "payment_source": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/payment_source",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/payment_source"
        }
      },
      "attachments": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/attachments",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/attachments"
        }
      },
      "events": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/events",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/events"
        }
      },
      "versions": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/versions",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/versions"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/event_stores"
        }
      },
      "captures": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/captures",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/captures"
        }
      },
      "voids": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/relationships/voids",
          "related": "https://yourdomain.commercelayer.io/api/authorizations/XAyRWNUzyN/voids"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}
