# Update a shipping method

To [update](https://docs.commercelayer.io/core/updating-resources) an existing shipping method, send a `PATCH` request to the `/api/shipping_methods/: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/shipping\\_methods/:id>

### Arguments

| Body Parameter                            | Type      | Required |
| ----------------------------------------- | --------- | -------- |
| **type**                                  | `string`  | Required |
| **id**                                    | `string`  | Required |
| attributes.**name**                       | `string`  | Optional |
| attributes.**scheme**                     | `string`  | Optional |
| attributes.**currency\_code**             | `string`  | Optional |
| attributes.**external\_prices\_url**      | `string`  | Optional |
| attributes.**price\_amount\_cents**       | `integer` | Optional |
| attributes.**free\_over\_amount\_cents**  | `integer` | Optional |
| attributes.**use\_subtotal**              | `boolean` | Optional |
| attributes.**min\_weight**                | `float`   | Optional |
| attributes.**max\_weight**                | `float`   | Optional |
| attributes.**unit\_of\_weight**           | `string`  | Optional |
| attributes.**tax\_code**                  | `string`  | Optional |
| attributes.**\_disable**                  | `boolean` | Optional |
| attributes.**\_enable**                   | `boolean` | Optional |
| attributes.**\_reset\_circuit**           | `boolean` | Optional |
| attributes.**external\_includes**         | `array`   | Optional |
| attributes.**\_add\_tags**                | `string`  | Optional |
| attributes.**\_remove\_tags**             | `string`  | Optional |
| attributes.**reference**                  | `string`  | Optional |
| attributes.**reference\_origin**          | `string`  | Optional |
| attributes.**metadata**                   | `object`  | Optional |
| relationships.**market**                  | `object`  | Optional |
| relationships.**shipping\_zone**          | `object`  | Optional |
| relationships.**shipping\_category**      | `object`  | Optional |
| relationships.**stock\_location**         | `object`  | Optional |
| relationships.**shipping\_method\_tiers** | `array`   | Optional |
| relationships.**tags**                    | `array`   | Optional |

### Example

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

```shell
curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "shipping_methods",
    "id": "xYZkjABcde",
    "attributes": {
      "free_over_amount_cents": 9900
    },
    "relationships": {
      "market": {
        "data": {
          "type": "markets",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'
```

{% 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": "shipping_methods",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN"
    },
    "attributes": {
      "name": "Standard shipping",
      "scheme": "flat",
      "currency_code": "EUR",
      "external_prices_url": "https://external_prices.yourbrand.com",
      "price_amount_cents": 1000,
      "price_amount_float": 10.0,
      "formatted_price_amount": "€10,00",
      "free_over_amount_cents": 9900,
      "free_over_amount_float": 99.0,
      "formatted_free_over_amount": "€99,00",
      "use_subtotal": true,
      "min_weight": 3.0,
      "max_weight": 300.0,
      "unit_of_weight": "gr",
      "tax_code": "FR010000",
      "disabled_at": "2018-01-01T12:00:00.000Z",
      "shared_secret": "1c0994cc4e996e8c6ee56a2198f66f3c",
      "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"
      }
    },
    "relationships": {
      "market": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/market",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/market"
        }
      },
      "shipping_zone": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/shipping_zone",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/shipping_zone"
        }
      },
      "shipping_category": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/shipping_category",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/shipping_category"
        }
      },
      "stock_location": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/stock_location",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/stock_location"
        }
      },
      "delivery_lead_time_for_shipment": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/delivery_lead_time_for_shipment",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/delivery_lead_time_for_shipment"
        }
      },
      "shipping_method_tiers": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/shipping_method_tiers",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/shipping_method_tiers"
        }
      },
      "shipping_weight_tiers": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/shipping_weight_tiers",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/shipping_weight_tiers"
        }
      },
      "attachments": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/attachments",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/attachments"
        }
      },
      "notifications": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/notifications",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/notifications"
        }
      },
      "events": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/events",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/events"
        }
      },
      "tags": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/tags",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/tags"
        }
      },
      "versions": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/versions",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/versions"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/shipping_methods/XAyRWNUzyN/event_stores"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}
