Example of a live GraphQL query that waits for a new email matching specific criteria before returning. The server holds the connection until an email arrives or 60 seconds elapses (then returns HTTP 307).
Graphql Livequery is an example object payload from Testmail, with 5 top-level fields. It illustrates the shape of data this provider's APIs accept or return.
{
"title": "GraphQL API - Live query waiting for new email",
"description": "Example of a live GraphQL query that waits for a new email matching specific criteria before returning. The server holds the connection until an email arrives or 60 seconds elapses (then returns HTTP 307).",
"request": {
"method": "POST",
"url": "https://api.testmail.app/api/graphql",
"headers": {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
"body": {
"query": "query { inbox(namespace: \"mynamespace\", tag: \"signup-testuser999\", livequery: true) { result count emails { from subject text timestamp } } }"
}
},
"livequery_behavior": {
"description": "The server holds the request open until a matching email arrives or 60 seconds pass.",
"on_email_received": "Returns 200 with the matching email immediately.",
"on_timeout": "Returns HTTP 307 redirect to the same URL. The client must follow redirects and resend the request."
},
"response_on_match": {
"status": 200,
"body": {
"data": {
"inbox": {
"result": "success",
"count": 1,
"emails": [
{
"from": "no-reply@myapp.com",
"subject": "Welcome! Please complete your signup.",
"text": "Thank you for signing up. Please confirm your account.",
"timestamp": 1686010000000.0
}
]
}
}
}
}
}
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.