Create a coverage

post
/coverages

Create a coverage.

Note:

  • In the shipping_address object, either phone or email field must be populated with a value.
  • In the sender_address object, the email field must be populated with a value.
order
object
required
source_id
string
required

A globally-unique identifier for the order.

number
string

order number of store/platform

>= 1 characters
items
array[Order Item]
required

items of order

>= 1 items
shipping_address
Address
required

Refers to the location from which a package or shipment will be sent, typically the address of the supplier, distributor, or retailer that is shipping the goods.

Example:
{"street_1":"1104, South University Avenue","street_2":"","postal_code":"53916","city":"Beaver Dam","state":{"name":"Wisconsin"},"country_region":{"code":"USA"},"phone":"+14155552671","email":"[email protected]","first_name":"Joe","last_name":"Smith"}
sender_address
Address
required

Refers to the location of the person or organization that is sending a package or shipment, typically the address of the individual or company that is responsible for sending the goods to their destination.

Example:
{"street_1":"1104, South University Avenue","street_2":"","postal_code":"53916","city":"Beaver Dam","state":{"name":"Wisconsin"},"country_region":{"code":"USA"},"phone":"+14155552671","email":"[email protected]","first_name":"Joe","last_name":"Smith"}
trackings
array[Tracking]

tracking info list

order_date
string<date>
required

order_date should be in UTC timezone.

>= 1 characters
Example:
2022-01-01
Match pattern:
^[0-9]{4}-[0-9]{2}-[0-9]{2}$
subtotal
Amount
required

The order's subtotal. The value of this field should be equal to the sum of the unit_insured_amount multiplied by the quantity for all items.

shipping_total
Amount

shipping_total will be included in the insured value.

Created

meta
Meta
required

Meta data object.

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required
Allowed values:
2000020100404004220050000
Default:
20000
type
string
required
>= 1 characters
message
string
required
>= 1 characters
errors
array[Error]

Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.

data
Coverage
required
id
string
required

coverage id

>= 1 characters
source_id
string
required
policy_number
string
required

policy id from insurance supplier

>= 1 characters
Example:
412-231-231
status
string
required

policy status

>= 1 characters
Allowed values:
inactiveactivatedclaimedexpiredvoid
Example:
inactive
policy_detail_url
string
required

URL of the policy detail

>= 1 characters
premium
Amount
required
effective_time
string
required

Effective time of coverage, times in ISO8601 format.Show all...

>= 1 characters
Example:
2022-12-12T12:23:34.333Z
Match pattern:
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$
expiration_time
string
required

expiration time of coverage, render times in ISO8601 format e.g.: "2012-01-01T12:00:00Z"

>= 1 characters
Example:
2022-12-12T12:23:34.333Z
Match pattern:
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$
updated_at
string
required

Updated time in ISO8601 format.Show all...

>= 1 characters
Example:
2022-12-12T12:23:34.333Z
Match pattern:
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$
created_at
string
required

Created time in ISO8601 format.Show all...

>= 1 characters
Example:
2022-12-12T12:23:34.333Z
Match pattern:
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$
items
Order Item
required
shipping_address
Address
required
Example:
{"street_1":"1104, South University Avenue","street_2":"","postal_code":"53916","city":"Beaver Dam","state":{"name":"Wisconsin"},"country_region":{"code":"USA"},"phone":"+14155552671","email":"[email protected]","first_name":"Joe","last_name":"Smith"}
sender_address
Address
required
Example:
{"street_1":"1104, South University Avenue","street_2":"","postal_code":"53916","city":"Beaver Dam","state":{"name":"Wisconsin"},"country_region":{"code":"USA"},"phone":"+14155552671","email":"[email protected]","first_name":"Joe","last_name":"Smith"}
trackings
array[Tracking]

tracking information about package.

subtotal
Amount
required
shipping_total
Amount
premium_paid_by
string

Indicates who paid for the premium

Allowed values:
receiversender
Default:
receiver

Bad Request

meta
Meta

Meta data object.

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required
Allowed values:
2000020100404004220050000
Default:
20000
type
string
required
>= 1 characters
message
string
required
>= 1 characters
errors
array[Error]

Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.

data
object

Unauthorized

meta
Meta

Meta data object.

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required
Allowed values:
2000020100404004220050000
Default:
20000
type
string
required
>= 1 characters
message
string
required
>= 1 characters
errors
array[Error]

Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.

data
object

Unprocessable Entity (WebDAV)

meta
Meta

Meta data object.

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required
Allowed values:
2000020100404004220050000
Default:
20000
type
string
required
>= 1 characters
message
string
required
>= 1 characters
errors
array[Error]

Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.

data
object
Auth
:
Body
{ "order": { "source_id": "1334598", "number": "1334598", "items": [ { "source_id": "123456", "title": "Brown Handmade Leather Lacing Chelsea Ankle Boots - The other colors", "quantity": 1, "unit_insured_amount": { "amount": "12.23", "currency": "USD" }, "sku": "22970201-the-other-colors-8-5", "image_urls": [ "https://cdn.shopify.com/s/files/1/0608/6154/6741/products/product-image-883092552.jpg?v=1637892003" ] }, { "source_id": "123457", "title": "banana", "quantity": 3, "unit_insured_amount": { "amount": "25", "currency": "USD" }, "sku": "sku2", "image_urls": [ "https://image.xx/xx/xx.jpg" ] } ], "shipping_address": { "street_1": "1104, South University Avenue", "street_2": "", "postal_code": "53916", "city": "Beaver Dam", "state": { "name": "Wisconsin" }, "country_region": { "code": "USA" }, "phone": "+14155552671", "email": "[email protected]", "first_name": "Joe", "last_name": "Smith" }, "sender_address": { "street_1": "1104, South University Avenue", "street_2": "", "postal_code": "53916", "city": "Beaver Dam", "state": { "name": "Wisconsin" }, "country_region": { "code": "USA" }, "phone": "+14155552671", "email": "[email protected]", "first_name": "Joe", "last_name": "Smith" }, "trackings": [ { "slug": "ups", "tracking_number": "1Z9999W99999999999", "ship_date": "2023-01-31" } ], "subtotal": { "amount": "87.23", "currency": "USD" }, "shipping_total": { "amount": "0", "currency": "USD" }, "order_date": "2023-01-30" } }
Response Example
{ "meta": { "code": 20100, "type": "Created", "message": "" }, "data": { "id": "e96931e5d9bb4f9ab9312ae4a7581422", "source_id": "1234569", "policy_number": "ea680f10cdda49f381e24530fb5ffc09", "status": "activated", "policy_detail_url": "https://demo.aftership.io/protection/policy?code=c06f732bb503d00a099d424bcf333b11&policyId=e96931e5d9bb4f9ab9312ae4a7581422", "premium": { "amount": "1.50", "currency": "USD" }, "effective_time": "2023-02-08T04:04:57Z", "expiration_time": "2023-05-09T04:04:57Z", "updated_at": "2023-02-08T04:04:57.36532Z", "created_at": "2023-02-08T04:04:57.36532Z", "items": [ { "source_id": "123456", "title": "Brown Handmade Leather Lacing Chelsea Ankle Boots - The other colors", "quantity": 1, "unit_insured_amount": { "amount": "12.23", "currency": "USD" }, "sku": "22970201-the-other-colors-8-5", "image_urls": [ "https://cdn.shopify.com/s/files/1/0608/6154/6741/products/product-image-883092552.jpg?v=1637892003" ] }, { "source_id": "123457", "title": "banana", "quantity": 3, "unit_insured_amount": { "amount": "25", "currency": "USD" }, "sku": "sku2", "image_urls": [ "https://image.xx/xx/xx.jpg" ] } ], "shipping_address": { "street_1": "1104, South University Avenue", "street_2": "", "postal_code": "53916", "city": "Beaver Dam", "state": { "name": "Wisconsin" }, "country_region": { "code": "USA" }, "phone": "+14155552671", "email": "[email protected]", "first_name": "Joe", "last_name": "Smith" }, "sender_address": { "street_1": "1104, South University Avenue", "street_2": "", "postal_code": "53916", "city": "Beaver Dam", "state": { "name": "Wisconsin" }, "country_region": { "code": "USA" }, "phone": "+14155552671", "email": "[email protected]", "first_name": "Joe", "last_name": "Smith" }, "trackings": [ { "slug": "ups", "tracking_number": "1Z9999W99999999999", "ship_date": "" } ], "subtotal": { "amount": "87.23", "currency": "USD" }, "shipping_total": { "amount": "0.00", "currency": "USD" } } }