Bulk import account Email Sending suppressions
client.EmailSending.Suppressions.Import(ctx, params) (*SuppressionImportResponse, error)
POST/accounts/{account_id}/email/sending/suppressions/bulk
Imports up to 1,000 Email Sending suppressions in one request. Each item applies to every sending domain of the account (default) or to one sending domain.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Bulk import account Email Sending suppressions
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/email_sending"
"github.com/cloudflare/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.EmailSending.Suppressions.Import(context.TODO(), email_sending.SuppressionImportParams{
AccountID: cloudflare.F("12345678"),
Items: cloudflare.F([]email_sending.SuppressionImportParamsItem{email_sending.SuppressionImportParamsItem{
Email: cloudflare.F("user@example.com"),
}, email_sending.SuppressionImportParamsItem{
Email: cloudflare.F("other@example.com"),
}}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Invalid)
}
{
"errors": [
{}
],
"messages": [
{}
],
"result": {
"deduplicated": 1,
"errors": 0,
"invalid": 1,
"items": [
{
"index": 0,
"status": "processed",
"id": "396a5436-d4b0-42a6-b3fc-48e8fa522321",
"email": "user@example.com",
"error": "Invalid email",
"scope": {
"type": "sending_domain",
"value": "mail.example.com"
}
}
],
"processed": 2,
"skipped": 0,
"total": 4
},
"success": true
}Returns Examples
{
"errors": [
{}
],
"messages": [
{}
],
"result": {
"deduplicated": 1,
"errors": 0,
"invalid": 1,
"items": [
{
"index": 0,
"status": "processed",
"id": "396a5436-d4b0-42a6-b3fc-48e8fa522321",
"email": "user@example.com",
"error": "Invalid email",
"scope": {
"type": "sending_domain",
"value": "mail.example.com"
}
}
],
"processed": 2,
"skipped": 0,
"total": 4
},
"success": true
}