Skip to content
AI Inbx
Esc
↑↓navigate↵open⌘Jpreview

Simulate a reply

Answers an email the sandbox sent, as one of its recipients would: to its Reply-To, else its sender, with Re: before the subject, the email quoted below, and In-Reply-To and References naming it. It then arrives like any inbound email, in the email’s thread when it lands in the same space; with headers such as Auto-Submitted: auto-replied it is an automatic reply. from defaults to the email’s first to. An email that has not gone out fails with 409 not_sent, and one whose Reply-To names nobody of the workspace with 422 recipient_unknown. Each copy filed counts as one of the sandbox’s emails for the day, and past them the request fails with 429 sandbox_limit_reached. On a live workspace it fails with 403 sandbox_only. A send can also be answered on its own: in a sandbox, mail to reply@simulator.aiinbx.com is delivered and then answered, each copy of the answer one of the day’s emails, mail to bounce@simulator.aiinbx.com bounces, and mail to complaint@simulator.aiinbx.com is delivered and then marked as spam. Mail to an address of the workspace is reported delivered and also arrives there as an inbound email, each copy filed one of the day’s emails; once they are used up, the send is still reported delivered and no copy is filed. Every other address is reported delivered, and nothing leaves AI Inbx.

POST/sandbox/emails/{email_id}/reply
Authorization
AuthorizationBearer token (API key) · headerrequired

Pass an AI Inbx API key as a Bearer token.

Path parameters
email_idstringrequired

The prefixed email ID.

matches ^[a-z]+_[0-9a-f]{32}$
Header parameters
AIInbx-Workspacestring

Workspace id from GET /workspaces, for an OAuth token that reaches several.

min length 1
Request body
application/json
fromstring | object

Who answers, dana@example.net or Dana <dana@example.net>. Defaults to the email's first to.

Show properties
Any of:
string
string
object
namestring
min length 1 · max length 200
addressstring<email>required
matches ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
attachmentsobject[]

Files attached, at most 20 and 3 MB decoded in total: filename, content_type and content in base64, and a cid to make one an inline image.

max items 20
Show properties
Array of object
filenamestringrequired
min length 1 · max length 255
content_typestringrequired
min length 1 · max length 255
contentstringrequired
max length 4000000
cidstring
max length 998
textstring

The plain-text body.

max length 2000000
htmlstring

The HTML body.

max length 2000000
headersobject

Extra headers on the email, as the sender's mail system wrote them: Auto-Submitted: auto-replied or X-Autoreply for an automatic reply, Precedence: bulk, List-Id and List-Unsubscribe for a mailing list, or headers of your own. They are on the email's headers, and its category is read from them as from real mail's. From, Sender, To, Cc, Bcc, Reply-To, Subject, Date, Message-ID, In-Reply-To, References, MIME-Version and Content-* are written from the request and are refused.

verdictsobject

What the receiving checks made of the email, as its verdicts reads them back: each PASS or FAIL, PASS when left out. spf, dkim and dmarc are recorded as given.

Show properties
spamstring

FAIL files the email as spam: it still arrives and fires email.received, with the category spam.

default: "PASS"
Allowed:PASSFAIL
spfstring
default: "PASS"
Allowed:PASSFAIL
dkimstring
default: "PASS"
Allowed:PASSFAIL
dmarcstring
default: "PASS"
Allowed:PASSFAIL
Responses
201

The reply arrived.

idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
thread_idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
space_idstring | nullrequired

Which space a resource is in. Null is the workspace itself — what every resource of a workspace that has no spaces says.

Show properties
Any of:
string
string
null
null
sandboxbooleanrequired

Whether the workspace is a sandbox: the email was simulated, and nothing was sent to or received from outside AI Inbx.

directionstringrequired
Allowed:inboundoutbound
statusstringrequired
Allowed:draftscheduledcanceleddiscardedqueuedsendingsentdeliveredbouncedcomplainedfailedreceived
fromobjectrequired
Show properties
namestring | null
Show properties
Any of:
string
string
null
null
addressstring<email>required
matches ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
tostring<email>[]required
delivered_tostring<email>[]required

On received mail, every address of yours it arrived at so far, whatever its To and Cc say. Empty on mail you sent.

ccstring<email>[]
bccstring<email>[]
reply_tostring<email>[]
subjectstringrequired
snippetstringrequired
htmlstring | null
Show properties
Any of:
string
string
null
null
textstring | null
Show properties
Any of:
string
string
null
null
categorystring | nullrequired
Show properties
Any of:
string
string
null
null
verdictsobject | nullrequired
Show properties
Any of:
object
spamstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
spfstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
dkimstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
dmarcstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
null
null
verificationobject | nullrequired
Show properties
Any of:
object
codestring | nullrequired

The one-time code to type in, as the email writes it: 482913, 482 913, G-482913. Null when it gives none.

Show properties
Any of:
string
string
null
null
linkstring | nullrequired

The link that verifies, confirms, signs in or resets, exactly as the email links it. Null when it has none.

Show properties
Any of:
string
string
null
null
null
null
unavailableobject | nullrequired
Show properties
Any of:
object
reasonstringrequired

absent: away for now — holiday, leave, travel. left: no longer at this address. unmonitored: nobody reads it. More reasons may be added; treat one you do not know as unreachable.

Allowed:absentleftunmonitored
back_onstring<date> | nullrequired

The first day the sender is back, when the reply says. A reply away "until" a day is read as back the next working day. Null when it names no day, when that day had already passed when the reply arrived, and for left and unmonitored.

Show properties
Any of:
string<date>
string<date>
null
null
contactsstring<email>[]required

Addresses the reply says to write to instead — a colleague, a team inbox. Empty when it names none.

null
null
suppression_keystring | nullrequired
Show properties
Any of:
string
string
null
null
message_idstringrequired

The RFC Message-ID, without angle brackets.

in_reply_tostring | nullrequired

The Message-ID of the message this one answers, without angle brackets. Null when it answers none.

Show properties
Any of:
string
string
null
null
idempotency_keystring | nullrequired
Show properties
Any of:
string
string
null
null
created_atstring<date-time>required

When it took its place in its thread. A draft's moves to when it is sent — draft.drafted_at keeps when it was written.

matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
scheduled_atstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
sent_atstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
draftobject | nullrequired
Show properties
Any of:
object
drafted_atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
edited_atstring<date-time> | nullrequired

When its content last changed before it was sent. Null when it went as written.

Show properties
Any of:
string<date-time>
string<date-time>
null
null
review_urlstring<uri> | nullrequired

Where a person reviews, edits and sends it in the console.

Show properties
Any of:
string<uri>
string<uri>
null
null
null
null
attachmentsobject[]
Show properties
Array of object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
filenamestringrequired
content_typestringrequired
sizeintegerrequired
min 0 · max 9007199254740991
cidstring | nullrequired
Show properties
Any of:
string
string
null
null
download_urlstring<uri> | nullrequired

Signed URL for the original bytes, good until expires_at. Opens without the API key, so treat it as a secret — and do not send the key to it: storage answers a request that carries an Authorization header with 400. To keep a reference, store the attachment id and call GET /attachments/{id}. Null when the bytes are gone.

Show properties
Any of:
string<uri>
string<uri>
null
null
expires_atstring<date-time> | nullrequired

When download_url and preparation.content_url stop working — an hour after the response. Read the email again, or call the download endpoint with the attachment ID, for fresh ones.

Show properties
Any of:
string<date-time>
string<date-time>
null
null
preparationobject | nullrequired
Show properties
Any of:
object
statusstringrequired
Allowed:readypartialunsupportedfailed
formatstring | nullrequired
Show properties
Any of:
string
string
null
null
pagesinteger | nullrequired
Show properties
Any of:
integer
integer
null
null
warningsstring[]required
content_urlstring<uri> | nullrequired

Signed URL for the prepared text, good until the attachment's expires_at. Opens without the API key — and only without it: storage answers a request that carries an Authorization header with 400. Null when there is no prepared text.

Show properties
Any of:
string<uri>
string<uri>
null
null
textstring | null
Show properties
Any of:
string
string
null
null
null
null
400

The request is invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
401

The API key is missing or invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
402

The workspace has no plan (plan_required), or its plan's allowance is used up (allowance_reached).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
403

The API key or token does not have the required scope, the operation is admin-only and the person it acts for (a key's creator) is not an admin, the token is connected as an inbox and the operation is not one an inbox may use, the workspace is a sandbox and the operation needs a live one or would pass one of a sandbox's ceilings, such as its 10 custom domains (sandbox_unavailable, detail names the limit), or the workspace is live and the operation simulates mail for a sandbox (sandbox_only).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
404

The requested resource does not exist.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
409

The request conflicts with the resource's current state.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
413

The request body or attachments are too large.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
415

The request body is not JSON.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
422

The request body failed validation (invalid_request, with issues naming each field), or names something the request cannot use, such as an attachment or a recipient the workspace does not have; code says which.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
429

The organisation's request budget is spent (too_many_requests), an upstream mail provider is throttling (rate_limited), or a sandbox has used its emails for the day (sandbox_limit_reached), which going live lifts.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
500

An internal error occurred.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
502

An upstream mail provider failed.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
503

The service is temporarily unavailable.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
Request
import AIInbx from "aiinbx"

const aiinbx = new AIInbx()

const response = await aiinbx.sandboxEmails.reply(
  "eml_0192a3b4c5d67890abcdef1234567890"
)
Response
{
  "id": "string",
  "thread_id": "string",
  "space_id": "string",
  "sandbox": true,
  "direction": "inbound",
  "status": "draft",
  "from": {
    "name": "string",
    "address": "user@example.com"
  },
  "to": [
    "user@example.com"
  ],
  "delivered_to": [
    "user@example.com"
  ],
  "cc": [
    "user@example.com"
  ],
  "bcc": [
    "user@example.com"
  ],
  "reply_to": [
    "user@example.com"
  ],
  "subject": "string",
  "snippet": "string",
  "html": "string",
  "text": "string",
  "category": "human",
  "verdicts": {
    "spam": "string",
    "spf": "string",
    "dkim": "string",
    "dmarc": "string"
  },
  "verification": {
    "code": "string",
    "link": "string"
  },
  "unavailable": {
    "reason": "absent",
    "back_on": "2019-08-24",
    "contacts": [
      "user@example.com"
    ]
  },
  "suppression_key": "string",
  "message_id": "string",
  "in_reply_to": "string",
  "idempotency_key": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "scheduled_at": "2019-08-24T14:15:22Z",
  "sent_at": "2019-08-24T14:15:22Z",
  "draft": {
    "drafted_at": "2019-08-24T14:15:22Z",
    "edited_at": "2019-08-24T14:15:22Z",
    "review_url": "http://example.com"
  },
  "attachments": [
    {
      "id": "string",
      "filename": "string",
      "content_type": "string",
      "size": 0,
      "cid": "string",
      "download_url": "http://example.com",
      "expires_at": "2019-08-24T14:15:22Z",
      "preparation": {
        "status": "ready",
        "format": "markdown",
        "pages": -9007199254740991,
        "warnings": [
          "string"
        ],
        "content_url": "http://example.com",
        "text": "string"
      }
    }
  ]
}