Start connecting a Google mailbox
Returns the consent URL to open in a browser. After the user grants access, the mailbox is created with inbox sync enabled and the browser is redirected back to the dashboard. You bring your own OAuth app: register https://api.supasend.io/v1/mailboxes/oauth/google/callback as a redirect URI on it and pass its client ID and secret here.
curl -X POST "https://api.supasend.io/v1/mailboxes/oauth/google/start" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"email": "user@example.com",
"display_name": "John Doe",
"client_id": "example_string",
"client_secret": "example_string",
"tenant_id": "example_string"
}'
import requests
import json
url = "https://api.supasend.io/v1/mailboxes/oauth/google/start"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"email": "user@example.com",
"display_name": "John Doe",
"client_id": "example_string",
"client_secret": "example_string",
"tenant_id": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.supasend.io/v1/mailboxes/oauth/google/start", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"email": "user@example.com",
"display_name": "John Doe",
"client_id": "example_string",
"client_secret": "example_string",
"tenant_id": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"email": "user@example.com",
"display_name": "John Doe",
"client_id": "example_string",
"client_secret": "example_string",
"tenant_id": "example_string"
}`)
req, err := http.NewRequest("POST", "https://api.supasend.io/v1/mailboxes/oauth/google/start", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.supasend.io/v1/mailboxes/oauth/google/start')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"email": "user@example.com",
"display_name": "John Doe",
"client_id": "example_string",
"client_secret": "example_string",
"tenant_id": "example_string"
}'
response = http.request(request)
puts response.body
{
"auth_url": "example_string"
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
/v1/mailboxes/oauth/google/start
Target server for requests. Edit to use your own host.
API key in the format sk_live_<64 hex characters>
sk_live_<64 hex characters>The media type of the request body
Address of the mailbox being connected
Name shown to recipients in the From header
Your OAuth app's client ID
Your OAuth app's client secret (stored encrypted)
Microsoft only. Defaults to common.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. API key in the format sk_live_\<64 hex characters\>
Body
Address of the mailbox being connected
Name shown to recipients in the From header
Your OAuth app's client ID
Your OAuth app's client secret (stored encrypted)
Microsoft only. Defaults to common.