Skip to content

Run a pattern against this inbox's recent messages

POST
/v1/inboxes/{id}/extractors/test
curl --request POST \
--url https://api.facteur.eu/v1/inboxes/example/extractors/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "pattern": "example", "scope": "text" }'

Against the last 20 messages, not just the one on screen. A pattern that works on the message in front of you and fails on the previous ten is exactly the pattern that breaks a run at 3 am.

id
required
string

The inbox identifier — the same string that prefixes its receiving address.

Media typeapplication/json
object
pattern
string
scope
string
default: text
Allowed values: text html subject

Whether the pattern compiles, and what it captured. A pattern that does not compile answers 200 with valid: false and the engine’s error — it is a result, not a request failure.

Media typeapplication/json
object
valid

Whether the pattern compiles. false comes back with a 200 and an error — it is a result, not a request failure.

boolean
error
string
results
Array<object>
object
value
string
matched
boolean
matchedMessages
integer
totalMessages
integer
Examplegenerated
{
"valid": true,
"error": "example",
"results": [
{
"value": "example",
"matched": true
}
],
"matchedMessages": 1,
"totalMessages": 1
}

No usable credential. UNAUTHENTICATED when none was presented, KEY_UNKNOWN, KEY_REVOKED or KEY_EXPIRED when a key was — kept distinct on purpose, because “mint a new one” and “somebody took this away from you” are different facts to whoever is reading a red pipeline.

Media typeapplication/json

Every failure has this shape. Branch on error.code; error.message is written for a human and is in French today.

object
error
required
object
code
required

The stable, machine-readable reason.

string
message

A sentence for whoever is reading the failure. Not part of the contract.

string
Example
{
"error": {
"code": "SCOPE_INSUFFICIENT"
}
}

SCOPE_INSUFFICIENT (the message names the scope this request wanted and the ones the key holds), KEY_CANNOT_REACH (no scope opens this route to a key at all), FORBIDDEN, or one of the stated refusals listed under x-api-key-refusals.

Media typeapplication/json

Every failure has this shape. Branch on error.code; error.message is written for a human and is in French today.

object
error
required
object
code
required

The stable, machine-readable reason.

string
message

A sentence for whoever is reading the failure. Not part of the contract.

string
Example
{
"error": {
"code": "SCOPE_INSUFFICIENT"
}
}

INBOX_NOT_FOUND. An inbox in a workspace the key does not reach answers the same way as one that does not exist — telling the two apart would let anyone map a colleague’s workspaces one request at a time.

Media typeapplication/json

Every failure has this shape. Branch on error.code; error.message is written for a human and is in French today.

object
error
required
object
code
required

The stable, machine-readable reason.

string
message

A sentence for whoever is reading the failure. Not part of the contract.

string
Example
{
"error": {
"code": "SCOPE_INSUFFICIENT"
}
}