API: custom shipping methods
This REST API endpoint allows you to create custom shipping methods.
- Get all shipping methods
 - Get a specific shipping method
 - Create a shipping method
 - Update a shipping method
 - Delete a shipping method
 
GET /api/shipping_methods
This method returns existing shipping methods list.
Resource URL
https://app.snipcart.com/api/shipping_methodsHeaders
| Name | Value | Required? | Description | 
|---|---|---|---|
Accept | 
application/json | 
Yes | Our API only accepts application/json content type, so you must always specify Accept: application/json header on each request you make. | 
Example request
curl -H "Accept: application/json" \
    https://app.snipcart.com/api/shipping_methods
    -u {API_KEY}:Example response
[
  {
    "name": "International shipping",
    "guaranteedEstimatedDelivery": {
      "minimumDaysForDelivery": 10,
      "maximumDaysForDelivery": null
    },
    "location": {
      "country": null,
      "province": null
    },
    "rates": [
      {
        "cost": 20,
        "weight": {
          "to": 1000
        }
      },
      {
        "cost": 30,
        "weight": {
          "from": 1000,
          "to": 2000
        }
      },
      {
        "cost": 60,
        "weight": {
          "from": 3000
        }
      }
    ],
    "id": "e4aba83a-8ff5-41f1-b9f6-a3e3aea3fdde",
    "creationDate": "2017-04-04T15:04:53.377Z",
    "modificationDate": "2017-04-04T15:04:53.377Z"
  },
  {
    "postalCodeRegex": "G1K.*",
    "name": "Local shipping",
    "guaranteedEstimatedDelivery": {
      "minimumDaysForDelivery": 2,
      "maximumDaysForDelivery": null
    },
    "location": {
      "country": "CA",
      "province": "QC"
    },
    "rates": [
      {
        "cost": 0,
        "weight": {
          "to": 1000
        }
      },
      {
        "cost": 5,
        "weight": {
          "from": 1000,
          "to": 2000
        }
      },
      {
        "cost": 7.5,
        "weight": {
          "from": 2000
        }
      }
    ],
    "id": "1391ecc9-3f1b-4a85-bc8e-beb745e4c6d2",
    "creationDate": "2017-04-04T15:06:31.967Z",
    "modificationDate": "2017-04-04T15:06:31.967Z"
  },
  {
    "postalCodeRegex": "G1K.*",
    "name": "Domestic shipping",
    "guaranteedEstimatedDelivery": {
      "minimumDaysForDelivery": 5,
      "maximumDaysForDelivery": null
    },
    "location": {
      "country": "CA",
      "province": null
    },
    "rates": [
      {
        "cost": 5,
        "weight": {
          "to": 1000
        }
      },
      {
        "cost": 10,
        "weight": {
          "from": 1000,
          "to": 2000
        }
      },
      {
        "cost": 20,
        "weight": {
          "from": 2000
        }
      }
    ],
    "id": "0222da02-ab21-4c4c-ad4e-c06f89f3c966",
    "creationDate": "2017-04-04T15:05:42.873Z",
    "modificationDate": "2017-04-04T15:05:42.873Z"
  }
]GET /api/shipping_methods/{id}
This method returns a specific shipping method information.
Resource URL
https://app.snipcart.com/api/shipping_methods/{id}URL Parameters
| Name | Required? | Type | Description | 
|---|---|---|---|
id | 
Yes | guid | 
The shipping method unique identifier. | 
Headers
| Name | Value | Required? | Description | 
|---|---|---|---|
Accept | 
application/json | 
Yes | Our API only accepts application/json content type, so you must always specify Accept: application/json header on each request you make. | 
Example request
curl -H "Accept: application/json" \
    https://app.snipcart.com/api/shipping_methods/0222da02-ab21-4c4c-ad4e-c06f89f3c966
    -u {API_KEY}:Example response
{
  "postalCodeRegex": "G1K.*",
  "name": "Domestic shipping",
  "guaranteedEstimatedDelivery": {
    "minimumDaysForDelivery": 5,
    "maximumDaysForDelivery": null
  },
  "location": {
    "country": "CA",
    "province": null
  },
  "rates": [
    {
      "cost": 5,
      "weight": {
        "to": 1000
      }
    },
    {
      "cost": 10,
      "weight": {
        "from": 1000,
        "to": 2000
      }
    },
    {
      "cost": 20,
      "weight": {
        "from": 2000
      }
    }
  ],
  "id": "0222da02-ab21-4c4c-ad4e-c06f89f3c966",
  "creationDate": "2017-04-04T15:05:42.873Z",
  "modificationDate": "2017-04-04T15:05:42.873Z"
}POST /api/shipping_methods
This method allows you to create a custom shipping method.
Resource URL
https://app.snipcart.com/api/shipping_methodsHeaders
| Name | Value | Required? | Description | 
|---|---|---|---|
Accept | 
application/json | 
Yes | Our API only accepts application/json content type, so you must always specify Accept: application/json header on each request you make. | 
Content-Type | 
application/json | 
Yes | Specifies the content type of the request body. | 
Custom shipping method parameters
| Name | Required | Type | Description | 
|---|---|---|---|
name | 
Yes | string | 
The shipping method name | 
location | 
No | object | 
The location where the shipping method is available. Can be specified with country and province properties. You must use country code and province code.  Example: { "country": "CA", "province": "QC" }If location is not specified, the shipping method will be offered for any shipping address.  | 
guaranteedEstimatedDelivery | 
No | object | 
The number of estimated days for delivery. Example: { "minimumDaysForDelivery": 1, "maximumDaysForDelivery": 5 }You can set only the minimum or maximum value if needed.  | 
rates | 
Yes | object[] | 
The rates associated to this shipping method. Refer to the next section to define a rate object. | 
Rate parameters
| Name | Required | Type | Description | 
|---|---|---|---|
cost | 
Yes | decimal | 
The cost of the shipping rate. Must be a valid decimal value. | 
weight | 
No | object | 
The weight range that the rate is applicable to. Example: { "from": 10, "to": 100 }The unit must be specified in grams. If not specified, the shipping rate will be available regardless of the order total weight.  | 
location | 
No | object | 
If specified, the rate will be available only if the order shipping address matches the location. Example: { "country": "CA", "province": "QC" } | 
Request payload example
{
  "postalCodeRegex": "G1K.*",
  "name": "Domestic shipping",
  "guaranteedEstimatedDelivery": {
    "minimumDaysForDelivery": 5,
    "maximumDaysForDelivery": null
  },
  "location": {
    "country": "CA",
    "province": null
  },
  "rates": [
    {
      "cost": 5,
      "weight": {
        "to": 1000
      }
    },
    {
      "cost": 10,
      "weight": {
        "from": 1000,
        "to": 2000
      }
    },
    {
      "cost": 20,
      "weight": {
        "from": 2000
      }
    }
  ]
}Response example
{
  "postalCodeRegex": "G1K.*",
  "name": "Domestic shipping",
  "guaranteedEstimatedDelivery": {
    "minimumDaysForDelivery": 5,
    "maximumDaysForDelivery": null
  },
  "location": {
    "country": "CA",
    "province": null
  },
  "rates": [
    {
      "cost": 5,
      "weight": {
        "to": 1000
      }
    },
    {
      "cost": 10,
      "weight": {
        "from": 1000,
        "to": 2000
      }
    },
    {
      "cost": 20,
      "weight": {
        "from": 2000
      }
    }
  ],
  "id": "0222da02-ab21-4c4c-ad4e-c06f89f3c966",
  "creationDate": "2017-04-04T15:05:42.873Z",
  "modificationDate": "2017-04-04T15:05:42.873Z"
}PUT /api/shipping_methods/{id}
This method allows you to update an existing custom shipping method.
Resource URL
https://app.snipcart.com/api/shipping_methods/{id}URL Parameters
| Name | Required? | Type | Description | 
|---|---|---|---|
id | 
Yes | guid | 
The shipping method unique identifier. | 
Headers
| Name | Value | Required? | Description | 
|---|---|---|---|
Accept | 
application/json | 
Yes | Our API only accepts application/json content type, so you must always specify Accept: application/json header on each request you make. | 
Content-Type | 
application/json | 
Yes | Specifies the content type of the request body. | 
Custom shipping method parameters
| Name | Required | Type | Description | 
|---|---|---|---|
name | 
Yes | string | 
The shipping method name | 
location | 
No | object | 
The location where the shipping method is available. Can be specified with country and province properties. You must use country code and province code.  Example: { "country": "CA", "province": "QC" }If location is not specified, the shipping method will be offered for any shipping address.  | 
guaranteedEstimatedDelivery | 
No | object | 
The number of estimated days for delivery. Example: { "minimumDaysForDelivery": 1, "maximumDaysForDelivery": 5 }You can set only the minimum or maximum value if needed.  | 
rates | 
Yes | object[] | 
The rates associated to this shipping method. Refer to the next section to define a rate object. | 
Rate parameters
| Name | Required | Type | Description | 
|---|---|---|---|
cost | 
Yes | decimal | 
The cost of the shipping rate. Must be a valid decimal value. | 
weight | 
No | object | 
The weight range that the rate is applicable to. Example: { "from": 10, "to": 100 }The unit must be specified in grams. If not specified, the shipping rate will be available regardless of the order total weight.  | 
location | 
No | object | 
If specified, the rate will be available only if the order shipping address matches the location. Example: { "country": "CA", "province": "QC" } | 
Request payload example
{
  "id": "0222da02-ab21-4c4c-ad4e-c06f89f3c966",
  "postalCodeRegex": "G1K.*",
  "name": "Domestic shipping",
  "guaranteedEstimatedDelivery": {
    "minimumDaysForDelivery": 5,
    "maximumDaysForDelivery": null
  },
  "location": {
    "country": "CA",
    "province": null
  },
  "rates": [
    {
      "cost": 5,
      "weight": {
        "to": 1000
      }
    },
    {
      "cost": 10,
      "weight": {
        "from": 1000,
        "to": 2000
      }
    },
    {
      "cost": 20,
      "weight": {
        "from": 2000
      }
    }
  ]
}Response example
{
  "postalCodeRegex": "G1K.*",
  "name": "Domestic shipping",
  "guaranteedEstimatedDelivery": {
    "minimumDaysForDelivery": 5,
    "maximumDaysForDelivery": null
  },
  "location": {
    "country": "CA",
    "province": null
  },
  "rates": [
    {
      "cost": 5,
      "weight": {
        "to": 1000
      }
    },
    {
      "cost": 10,
      "weight": {
        "from": 1000,
        "to": 2000
      }
    },
    {
      "cost": 20,
      "weight": {
        "from": 2000
      }
    }
  ],
  "id": "0222da02-ab21-4c4c-ad4e-c06f89f3c966",
  "creationDate": "2017-04-04T15:05:42.873Z",
  "modificationDate": "2017-04-04T15:10:42.873Z"
}DELETE /api/shipping_methods/{id}
This method allows you to delete a custom shipping method. When successful it returns a 204 No Content response with an empty body.
Resource URL
https://app.snipcart.com/api/shipping_methods/{id}URL Parameters
| Name | Required? | Type | Description | 
|---|---|---|---|
id | 
Yes | guid | 
The shipping method unique identifier. | 
Headers
| Name | Value | Required? | Description | 
|---|---|---|---|
Accept | 
application/json | 
Yes | Our API only accepts application/json content type, so you must always specify Accept: application/json header on each request you make. |