# Create a shipping method

To [create](https://docs.commercelayer.io/core/creating-resources) a new shipping method, send a `POST` request to the `/api/shipping_methods` endpoint, passing the resource arguments in the request body.

## Request

**POST** <https://yourdomain.commercelayer.io/api/shipping\\_methods>

### Arguments

| Body Parameter                            | Type      | Required                                                 |
| ----------------------------------------- | --------- | -------------------------------------------------------- |
| **type**                                  | `string`  | Required                                                 |
| attributes.**name**                       | `string`  | Required                                                 |
| attributes.**scheme**                     | `string`  | Optional, default is 'flat'                              |
| attributes.**currency\_code**             | `string`  | Required, unless inherited by market                     |
| attributes.**external\_prices\_url**      | `string`  | Required, if external scheme                             |
| attributes.**price\_amount\_cents**       | `integer` | Required                                                 |
| attributes.**free\_over\_amount\_cents**  | `integer` | Optional                                                 |
| attributes.**use\_subtotal**              | `boolean` | Optional, deafult is 'false'                             |
| attributes.**min\_weight**                | `float`   | Optional                                                 |
| attributes.**max\_weight**                | `float`   | Optional                                                 |
| attributes.**unit\_of\_weight**           | `string`  | Optional, unless min or max weight are specified         |
| attributes.**tax\_code**                  | `string`  | Optional, default to tax calculator generic freight code |
| attributes.**\_disable**                  | `boolean` | Optional                                                 |
| attributes.**\_enable**                   | `boolean` | Optional                                                 |
| attributes.**external\_includes**         | `array`   | Optional, default to resource specific list              |
| 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 creates a new shipping method:

```shell
curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/shipping_methods' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "shipping_methods",
    "attributes": {
      "name": "Standard shipping",
      "currency_code": "EUR",
      "external_prices_url": "https://external_prices.yourbrand.com",
      "price_amount_cents": 1000
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `201 Created` status code, returning the created 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,
      "price_amount_for_shipment_cents": 0,
      "price_amount_for_shipment_float": 0.0,
      "formatted_price_amount_for_shipment": "€0,00",
      "min_weight": 3.0,
      "max_weight": 300.0,
      "unit_of_weight": "gr",
      "tax_code": "FR010000",
      "disabled_at": "2018-01-01T12:00:00.000Z",
      "circuit_state": "closed",
      "circuit_failure_count": 5,
      "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 %}
