Parse an email V2

post
/email-parses-v2

Parse orders and tracking detail from an email.

AfterShip Parser only returns parsing results that meet the conditions of the minimum valid parsing results during parsing. See Minimum Valid Parsing Result.

The size of the Request Body must be at most 27MB.

headers
array[EmailHeader]
required

Email headers in the raw email data. It is recommended to pass all headers for improving the parsing process, especially Subject , From , Date , Message-ID, References, and Delivered-To.Show all...

<= 100 items
name
string
required

Email header name.

<= 128 characters
value
string
required

Email header value.

<= 10240 characters
body
object
required

At least one out of HTML or text is required. HTML is recommended for a much better result.

html
string
required

The HTML content of an email.

>= 1 characters
text
string
required

The text content of an email.

>= 1 characters
attachments
array[Attachment] or null

Attachments of an email.Show all...

<= 30 items
labels
array[string]

Labels generated by email service providers such as Gmail

<= 50 items
country_region
string

ISO 3166 Alpha-3 code of the country or region. See ISO 3166 Country codes.

OK

meta
Meta
required

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
required
orders
array[OrderV2]

The order object contains at least 1 order number (order.number) or 1 tracking information (order.trackings.tracking_number). See Minimum Valid Parsing Result.

confidence_score
number<float>
required

The confidence score represents the probability that AfterShip Parser thinks the email contains order information. The higher the value, the more likely message includes order information.

>= 0<= 1
Example:
0.92

Bad Request

meta
Meta

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
required

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
required

Forbidden

meta
Meta
required

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
required

Unprocessable Entity

meta
Meta
required

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
required
confidence_score
number<float>

The confidence score represents the probability that AfterShip Parser thinks the email contains order information. The higher the value, the more likely message includes order information.

>= 0<= 1
Example:
0.96

Too Many Requests

meta
Meta

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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

Internal Server Error

meta
Meta

Meta data object.

Example:
{"code":201,"type":"Created","message":"The request has been fulfilled and a new resource has been created."}
code
number
required
Default:
200
Example:
200
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
{ "labels": [ "UNREAD", "IMPORTANT", "CATEGORY_UPDATES", "INBOX" ], "body": { "html": "<!DOCTYPE html><html lang=\"en\"><head><title>Thank you for your purchase! </title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><meta name=\"viewport\" content=\"width=device-width\"/></head><body>...</body></html>", "text": "Thank you for your purchase! ---------------------------- Hi Tom, we've received your order!", "attachments": [ { "filename": "xxx.pdf", "content_type": "application/pdf", "data": "base64" } ] }, "headers": [ { "name": "Reference", "value": "<CAasdfzM=ATfHsacasdfDO6o-xTOwnbasdfqwerqweradsVyasdfxzfQ@mail.gmail.com>" }, { "name": "From", "value": "[email protected]" }, { "name": "Subject", "value": "Your order xxxxxxxx" } ] }
Response Example
{ "meta": { "code": 200, "type": "OK", "message": "The request was successfully processed by Automizely." }, "data": { "orders": [ { "number": "23234324", "url": "https://www.amazon.com/gp/css/2323432.html", "placed_at": { "date": "2012-12-12", "time": "13:06:22", "utc_offset": 8, "timezone_identifier": "Asia/Shanghai" }, "status": "open", "store": { "name": "example store", "url": "https://www.example-store.com", "logo_url": "https://example-store.com/logo.png", "email": "[email protected]", "phone": { "calling_code": "1", "phone_number": "3105550199" }, "slug": "example-store" }, "items": [ { "external_product_id": "3123213", "title": "T-shirt", "url": "http://example.com/t-shirt.html", "image_url": "http://example.com/images/t-shirt.png", "quantity": 2, "unit_price": { "amount": "10.00", "currency": "USD", "raw_symbol": "$" }, "compare_unit_price": { "amount": "20.00", "currency": "USD", "raw_symbol": "$" }, "total_price": { "amount": "20.00", "currency": "USD", "raw_symbol": "$" }, "compare_total_price": { "amount": "40.00", "currency": "USD", "raw_symbol": "$" }, "variant_description": "size: XL - color: red", "status": null } ], "shipping_address": { "raw_location": "Los Angeles, CA, USA", "phone": { "calling_code": "1", "phone_number": "3105550199" }, "postal_code": "90003", "city": "Los Angeles", "state": { "name": "California", "code": "US-CA" }, "country_region": { "name": "United States", "code": "USA" } }, "shipping_method": { "name": "Standard - free" }, "billing_address": { "raw_location": "Los Angeles, CA, USA", "phone": { "calling_code": "1", "phone_number": "3105550199" }, "postal_code": "90003", "city": "Los Angeles", "state": { "name": "California", "code": "US-CA" }, "country_region": { "name": "United States", "code": "USA" } }, "total": { "amount": "19.00", "currency": "USD", "raw_symbol": "$" }, "subtotal": { "amount": "20.00", "currency": "USD", "raw_symbol": "$" }, "shipping_total": { "amount": "4.00", "currency": "USD", "raw_symbol": "$" }, "tax_total": { "amount": "1.00", "currency": "USD", "raw_symbol": "$" }, "discount_total": { "amount": "-5.00", "currency": "USD", "raw_symbol": "$" }, "other_prices": [ { "title": "Reward Coupon", "price": { "amount": "-1.00", "currency": "USD", "raw_symbol": "$" } } ], "trackings": [ { "status": "Delivered", "substatus": "Delivered_001", "tracking_number": "234234", "slug": "ups", "additional_fields": { "postal_code": "xxxxxx", "ship_date": null, "state": null, "origin_country": null, "destination_country": null }, "items": [ { "external_product_id": "3123213", "title": "T-shirt", "url": "http://example.com/t-shirt.html", "image_url": "http://example.com/images/t-shirt.png", "quantity": 2, "unit_price": { "amount": "10.00", "currency": "USD", "raw_symbol": "$" }, "compare_unit_price": { "amount": "20.00", "currency": "USD", "raw_symbol": "$" }, "total_price": { "amount": "20.00", "currency": "USD", "raw_symbol": "$" }, "compare_total_price": { "amount": "40.00", "currency": "USD", "raw_symbol": "$" }, "variant_description": "size: XL - color: red", "status": null } ], "tracking_url": "http://example.com", "shipping_provider": "Third Party" } ], "estimated_delivery_datetime": { "min": { "date": "2012-12-12", "time": "00:00:00", "utc_offset": 8, "timezone_identifier": "Asia/Shanghai" }, "max": { "date": "2012-12-13", "time": "00:00:00", "utc_offset": 8, "timezone_identifier": "Asia/Shanghai" }, "raw_delivery_text": "tomorrow" }, "pickup": { "location": { "raw_address": "Amazon Locker - 123 Example Street, London, United Kingdom", "raw_opening_hours": "Monday - Saturday: 08:00 AM - 10:00 PM Sunday: 09:00 AM - 08:00 PM", "opening_hours": { "sunday": [ { "open": true, "from": "09:00", "to": "20:00" } ], "monday": [ { "open": true, "from": "08:00", "to": "22:00" } ], "tuesday": [ { "open": true, "from": "08:00", "to": "22:00" } ], "wednesday": [ { "open": true, "from": "08:00", "to": "22:00" } ], "thursday": [ { "open": true, "from": "08:00", "to": "22:00" } ], "friday": [ { "open": true, "from": "08:00", "to": "22:00" } ], "saturday": [ { "open": true, "from": "08:00", "to": "22:00" } ] } }, "instructions": "You must bring your ID that matches the name on the parcel.", "code": "31232", "barcode": { "image_url": "http://example.com/images/barcode.png" }, "pickup_action_url": "https://www.example.com/pickup/start?order=12345", "available_datetime": { "start": null, "end": { "date": "2012-12-12", "time": null, "utc_offset": null, "timezone_identifier": null }, "raw": "PICK UP UNTIL Wednesday, Dec 12" } }, "requires_shipping": true } ], "confidence_score": 0.96 } }