Instead of making multiple individual requests, use the batch endpoint:
Python
Node.js
Ruby
Go
Copy
# Instead of this (100 requests)for email in emails: client.emails.send(**email)# Do this (1 request)client.emails.send_batch(emails=emails)
Copy
// Instead of this (100 requests)for (const email of emails) { await client.emails.send(email);}// Do this (1 request)await client.emails.sendBatch({ emails });
Copy
# Instead of this (100 requests)emails.each { |email| client.emails.send_(**email) }# Do this (1 request)client.emails.send_batch(emails: emails)
Copy
// Instead of this (100 requests)for _, email := range emails { client.Emails.Send(ctx, email)}// Do this (1 request)client.Emails.SendBatch(ctx, ark.EmailSendBatchParams{ Emails: emails,})
The SDKs handle exponential backoff automatically. Configure the number of retries:
Python
Node.js
Ruby
Go
Copy
from ark import Ark# Configure max retries - SDK uses exponential backoff automaticallyclient = Ark(max_retries=5)# All requests will retry up to 5 times with exponential backoff# for rate limits, timeouts, and server errorsemail = client.emails.send( from_="hello@yourdomain.com", to=["user@example.com"], subject="Hello", html="<p>Hello!</p>")
Copy
import Ark from 'ark';// Configure max retries - SDK uses exponential backoff automaticallyconst client = new Ark({ maxRetries: 5 });// All requests will retry up to 5 times with exponential backoff// for rate limits, timeouts, and server errorsconst email = await client.emails.send({ from: 'hello@yourdomain.com', to: ['user@example.com'], subject: 'Hello', html: '<p>Hello!</p>',});
Copy
require "ark_email"# Configure max retries - SDK uses exponential backoff automaticallyclient = ArkEmail::Client.new(max_retries: 5)# All requests will retry up to 5 times with exponential backoff# for rate limits, timeouts, and server errorsemail = client.emails.send_( from: "hello@yourdomain.com", to: ["user@example.com"], subject: "Hello", html: "<p>Hello!</p>")
Copy
import ( "github.com/ArkHQ-io/ark-go" "github.com/ArkHQ-io/ark-go/option")// Configure max retries - SDK uses exponential backoff automaticallyclient := ark.NewClient(option.WithMaxRetries(5))// All requests will retry up to 5 times with exponential backoff// for rate limits, timeouts, and server errorsemail, _ := client.Emails.Send(ctx, ark.EmailSendParams{ From: "hello@yourdomain.com", To: []string{"user@example.com"}, Subject: "Hello", HTML: ark.String("<p>Hello!</p>"),})