{
"google": {
"appName": "string (required if google section is present)",
"clientId": "string (required if google section is present)",
"mailboxesPerDomain": {
"domainId": [
{
"mailboxId": "string (UUID)",
"oauthLink": "string (URL)"
}
]
}
},
"microsoft": {
"mailboxesPerDomain": {
"domainId": [
{
"mailboxId": "string (UUID)",
"oauthLink": "string (URL)"
}
]
}
}
}| Field | Type | Required | Description |
|---|---|---|---|
| object | Optional | Contains configuration and OAuth links for Google mailboxes. | |
| google.appName | string | Required (if google is provided) | Name of the Google application. |
| google.clientId | string | Required (if google is provided) | Client ID of the Google OAuth app. |
| google.mailboxesPerDomain | object | Required (if google is provided) | Key-value map of domain IDs and mailbox entries. |
| microsoft | object | Optional | Contains configuration and OAuth links for Microsoft mailboxes. |
| microsoft.mailboxesPerDomain | object | Required (if microsoft is provided) | Key-value map of domain IDs and mailbox entries. |
| mailboxId | string (UUID) | Required | Unique identifier for the mailbox. Must be a valid UUID. |
| oauthLink | string (URL) | Required | Valid OAuth authorization link for the mailbox. |
google or microsoft sections must be present.appName and clientId are mandatory.mailboxesPerDomain must:mailboxId.oauthLink.| HTTP Status | When it Happens | Example Message |
|---|---|---|
| 400 Bad Request | One or more requested mailboxIds are not found for the authenticated user, or do not match the user’s serviceProvider or workspace; or Google client/app validation mismatch | Some mailboxes not foundApp name mismatch for client ID <CLIENT_ID>: expected <APP>, got <PROVIDER_APP>Validation failed for client ID <CLIENT_ID>: <provider error> |
| 404 Not Found | Google only: No admin mailbox is available on a domain that needs client ID addition | Admin mailbox not found for domain <DOMAIN_ID> |
| 429 Too Many Requests | Per-mailbox rate limit exceeded (3 in 7 days) | Rate limit exceeded for mailbox '<MAILBOX_ID>'\n Limit is 3 requests per 7 days |
| 422 Unprocessable Entity | Request body fails schema validation (see Validation Rules) | e.g. google.mailboxesPerDomain.<domain>[0].mailboxId must be a valid UUIDAt least one of 'google' or 'microsoft' sections must be provided |
429 Too Many RequestsRate limit exceeded for mailbox '<MAILBOX_ID>'\n Limit is 3 requests per 7 daysoauthLink should be generated dynamically per mailbox from the provider’s OAuth flow.ACTIVE, belong to the authenticated userId and workspaceId and have disableReason = null can be processed.400 Bad Request: Some mailboxes not found.curl --location --request POST 'https://api.zapmail.ai/api/v2/mailboxes/custom-oauth' \
--header 'x-auth-zapmail;' \
--header 'Content-Type: application/json' \
--data-raw '{
"google": {
"appName": "ColdStats",
"clientId": "1234567890-abcdefg1234567890.apps.googleusercontent.com",
"mailboxesPerDomain": {
"d91b34a0-67e9-4a3f-b1a8-31f8b6f7f001": [
{
"mailboxId": "a12c4b23-91f3-4b7b-8ad9-9876fcb23456",
"oauthLink": "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=1234567890-abcdefg1234567890.apps.googleusercontent.com&prompt=consent&redirect_uri=https%3A%2F%2Fapp.coldstats.ai%2Fauth%2Fgoogle%2Fcallback&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=9e5f124d-3e2b-4b09-8d3e-15a7e42db4a7"
},
{
"mailboxId": "b34f56e7-12cd-4e8a-9a67-8abf95acdef0",
"oauthLink": "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=1234567890-abcdefg1234567890.apps.googleusercontent.com&prompt=consent&redirect_uri=https%3A%2F%2Fapp.coldstats.ai%2Fauth%2Fgoogle%2Fcallback&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F&state=75a92c9b-2e7c-4968-bf9f-5e12c4dc9054"
}
]
}
},
"microsoft": {
"mailboxesPerDomain": {
"a45e91b7-36c2-4b91-91a4-56d3d0b87612": [
{
"mailboxId": "c67e21a1-7e43-4a1b-a25a-97a23d5e3a11",
"oauthLink": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=8c7f1b3f-9c1e-4aab-b6f8-fb01c1234567&response_type=code&redirect_uri=https%3A%2F%2Fapp.coldstats.ai%2Fauth%2Fmicrosoft%2Fcallback&response_mode=query&scope=Mail.Read+Mail.Send+offline_access+openid+profile&state=ee67c1ad-2e76-4870-b4a3-0a54a1c9a3b2"
}
]
}
}
}'{
"status": 200,
"message": "OAuth will be completed shortly",
"data": {
"exportId": 74187
}
}