Skip to content

Read the outcome of a connection

GET
/{provider}/oauth/result
curl --request GET \
--url 'https://api.clearance.rest/emails/gmail/oauth/result?token=example' \
--header 'X-API-Key: <X-API-Key>'

Call this from your backend with the result_token your return_url received. The token is single use: it is consumed on first read, a second call returns 404, and it expires after about 10 minutes.

A failed connection is still HTTP 200, with success: false and the reason in error.

provider
required
string
Allowed values: gmail outlook

Mail provider.

token
required
string

The result_token from the return_url redirect.

Outcome of the connection.

Media typeapplication/json
object
success
required
boolean
email

The connected address. Present on success.

string format: email
error

Why the connection failed. Present on failure.

string
client_state

The client_state you passed to oauth/start.

string
Examples
{
"success": true,
"email": "user@gmail.com",
"client_state": "user-42"
}

The X-API-Key header is missing or invalid.

Media typeapplication/json

Error envelope returned with a non-2xx status.

object
success
required
boolean
error
required

Human-readable error message.

string
Example
{
"success": false,
"error": "geçersiz API anahtarı"
}

The result belongs to a different project.

Media typeapplication/json

Error envelope returned with a non-2xx status.

object
success
required
boolean
error
required

Human-readable error message.

string
Example
{
"success": false,
"error": "invalid json body"
}

The token is invalid, expired, or already consumed.

Media typeapplication/json

Error envelope returned with a non-2xx status.

object
success
required
boolean
error
required

Human-readable error message.

string
Example
{
"success": false,
"error": "geçersiz veya süresi dolmuş token"
}