Check OAuth 2.0 mailbox connection status
Track the progress of connecting a Google or Microsoft mailbox to Woodpecker, from OAuth 2.0 authorization to the initial connection.
- For a connection batch submitted with SMTP/IMAP credentials, check SMTP/IMAP connection batch status.
- To check for mailbox connection status or errors after setup, use get a mailbox.
Request
Endpoint
POST https://api.woodpecker.co/rest/v2/mailboxes/oauth2/check_status
Headers
x-api-key: {YOUR_API_KEY}
Content-Type: application/json
For details on how to authenticate your requests, please see the authentication guide.
Body
{
"provider": "GOOGLE",
"email": "mailbox@example.com"
}
Body schema
| Field | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | Mailbox provider. Use GOOGLE or MICROSOFT, with matching capitalization |
email | string | Yes | Email address of the mailbox that is being connected to Woodpecker |
Request samples
Check the connection status of a Google mailbox
- cURL
- Python
- Java
- Node.js
- PHP
curl --request POST \
--url "https://api.woodpecker.co/rest/v2/mailboxes/oauth2/check_status" \
--header "x-api-key: {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"provider": "GOOGLE",
"email": "mailbox@example.com"
}'
import requests
def check_oauth2_mailbox_status():
url = "https://api.woodpecker.co/rest/v2/mailboxes/oauth2/check_status"
headers = {
"x-api-key": "{YOUR_API_KEY}",
"Content-Type": "application/json"
}
payload = {
"provider": "GOOGLE",
"email": "mailbox@example.com"
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json()
raise Exception(f"POST request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
try:
print("POST response:", check_oauth2_mailbox_status())
except Exception as error:
print("Error:", error)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class WoodpeckerApiClient {
public static void main(String[] args) {
try {
String url = "https://api.woodpecker.co/rest/v2/mailboxes/oauth2/check_status";
String jsonData = """
{
"provider": "GOOGLE",
"email": "mailbox@example.com"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", "{YOUR_API_KEY}")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() != 200) {
throw new IllegalStateException("POST request failed: " + response.statusCode() + ", " + response.body());
}
System.out.println("POST response: " + response.body());
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
}
}
const axios = require('axios');
async function checkOauth2MailboxStatus() {
const url = 'https://api.woodpecker.co/rest/v2/mailboxes/oauth2/check_status';
const headers = {
'x-api-key': '{YOUR_API_KEY}',
'Content-Type': 'application/json'
};
const data = {
provider: 'GOOGLE',
email: 'mailbox@example.com'
};
try {
const response = await axios.post(url, data, { headers });
console.log('POST response:', response.data);
} catch (error) {
console.error('POST request failed:', error.response ? error.response.status : error.message);
}
}
checkOauth2MailboxStatus();
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client([
'base_uri' => 'https://api.woodpecker.co/rest/v2/',
'headers' => [
'x-api-key' => getenv('WOODPECKER_API_KEY'),
'Content-Type' => 'application/json',
],
]);
try {
$response = $client->post('mailboxes/oauth2/check_status', [
'json' => [
'provider' => 'GOOGLE',
'email' => 'mailbox@example.com',
],
]);
echo $response->getStatusCode(), "\n";
echo $response->getBody(), "\n";
} catch (RequestException $e) {
echo 'Error: ', $e->getMessage(), "\n";
if ($e->hasResponse()) {
echo $e->getResponse()->getBody(), "\n";
}
}
Response
Response examples
- 200
- 401
- 404
- 422
- 500
The response contains the current status of the OAuth 2.0 connection process.
{
"provider": "GOOGLE",
"email": "mailbox@example.com",
"status": "CONNECTED"
}
Body schema
| Field | Type | Description |
|---|---|---|
provider | string | Mailbox provider, GOOGLE or MICROSOFT |
email | string | Normalized mailbox email address |
status | string | Current status of the connection process
|
CONNECTED records that setup succeeded. For connection issues that arise later, inspect details.error and details.reconnect_required on the SMTP mailbox entry. If you have the mailbox ID, get the mailbox. Otherwise, list mailboxes and find the SMTP entry by its details.email.
The API key is missing or invalid. Review the authentication guide.
{
"title": "Unauthorized",
"status": 401,
"detail": "Invalid api key",
"timestamp": "2026-11-23 12:00:00"
}
Body schema
| Field | Type | Description |
|---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
No OAuth 2.0 registration exists for this provider and email address in the current Woodpecker account.
Body: none
Returned when the request body is missing or contains invalid or missing fields.
{
"type": "validation_error",
"message": "Invalid field(s)",
"code": "invalid_fields",
"request_id": "1b752aaa-b067-4145-8e22-939582dfeb2c",
"fields": [
{
"field": "provider",
"issue": "required",
"value": null
}
]
}
Body schema
| Field | Type | Description |
|---|---|---|
type | string | Error type |
message | string | Error message |
code | string | Error code |
request_id | string or null | Request identifier when available |
fields | array | Fields that failed validation |
└─ field | string | Field with a validation issue |
└─ issue | string | Detailed description of the validation issue |
└─ value | string/null | Rejected value, or null for a missing required field |
An unexpected server error occurred. Depending on the situation, the body might be empty.
{
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred",
"timestamp": "2026-11-23 12:00:00"
}
Body schema
| Field | Type | Description |
|---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string or null | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |