Parse an email

post
/email-parses

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.

subject
string
required

Email Subject.

>= 1 characters<= 512 characters
from
string
required

Email From.

<= 128 characters
content
object

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
labels
array[string]

Labels generated by email service providers such as Gmail

<= 50 items

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[Order]

The order object contains at least 1 order information (order.order_number + order.store) or 1 tracking information (order.trackings.n.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.96

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
{ "from": "[email protected]", "subject": "Your order xxxxxxxx", "labels": [ "UNREAD", "IMPORTANT", "CATEGORY_UPDATES", "INBOX" ], "content": { "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!" } }
Response Example
{ "meta": { "code": 200, "type": "OK", "message": "The request was successfully processed by Automizely." }, "data": { "orders": [ { "order_number": "23234324", "order_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" }, "order_status": "open", "store": { "name": "example store", "url": "https://www.example-store.com", "logo_url": "https://example-store.com/logo.png", "email": "[email protected]", "phone": { "country_region_code": "1", "number": "3105550199" } }, "items": [ { "external_product_id": "3123213", "product_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", "symbol": "$" }, "compare_unit_price": { "amount": "20.00", "currency": "USD", "symbol": "$" }, "total_price": { "amount": "20.00", "currency": "USD", "symbol": "$" }, "compare_total_price": { "amount": "40.00", "currency": "USD", "symbol": "$" }, "variant_description": "size: XL - color: red", "status": null } ], "shipping_address": { "raw_location": "Los Angeles, CA, USA", "phone": { "country_region_code": "1", "number": "3105550199" } }, "shipping_method": { "name": "Standard - free" }, "billing_address": { "raw_location": "Los Angeles, CA, USA", "phone": { "country_region_code": "1", "number": "3105550199" } }, "order_total": { "amount": "19.00", "currency": "USD", "symbol": "$" }, "subtotal": { "amount": "20.00", "currency": "USD", "symbol": "$" }, "shipping_total": { "amount": "4.00", "currency": "USD", "symbol": "$" }, "tax_total": { "amount": "1.00", "currency": "USD", "symbol": "$" }, "discount_total": { "amount": "-5.00", "currency": "USD", "symbol": "$" }, "other_prices": [ { "title": "Reward Coupon", "price": { "amount": "-1.00", "currency": "USD", "symbol": "$" } } ], "trackings": [ { "status": "Delivered", "tracking_number": "234234", "slug": "ups", "additional_fields": { "postal_code": "xxxxxx" }, "items": [ { "external_product_id": "3123213", "product_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", "symbol": "$" }, "compare_unit_price": { "amount": "20.00", "currency": "USD", "symbol": "$" }, "total_price": { "amount": "20.00", "currency": "USD", "symbol": "$" }, "compare_total_price": { "amount": "40.00", "currency": "USD", "symbol": "$" }, "variant_description": "size: XL - color: red", "status": null } ] } ], "estimated_delivery_date": { "estimated_delivery_date_min": "2021-12-11", "estimated_delivery_date_max": "2021-12-12" } } ], "confidence_score": 0.96 } }