MailerSend
Guides

Checking your API quota

Inspect how many MailerSend API requests you have remaining and when the limit resets. The quota endpoint does not count toward your own quota.

The /v1/api-quota endpoint reports how many requests you have remaining and when your limit resets. Requests to this endpoint do not count toward your quota.

GET https://api.mailersend.com/v1/api-quota
use MailerSend\MailerSend;

$mailersend = new MailerSend();

$mailersend->apiQuota->get();

More examples

import 'dotenv/config';
import { MailerSend } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

mailerSend.apiQuota.get()
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examples

from mailersend import MailerSendClient

ms = MailerSendClient()

response = ms.api_quota.get_quota()

More examples

package main

import (
	"context"
	"log"
	"time"
	
	"github.com/mailersend/mailersend-go"
)

var APIKey = "Api Key Here"

func main() {
	// Create an instance of the mailersend client
	ms := mailersend.NewMailersend(APIKey)

	ctx := context.Background()
	ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
	defer cancel()

	_, _, err := ms.ApiQuota.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
}

More examples

import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.apiquota.ApiQuota;
import com.mailersend.sdk.exceptions.MailerSendException;

public void GetApiQuota() {
    
    MailerSend ms = new MailerSend();
    ms.setToken("api token");
    
    try {
        
        ApiQuota quota = ms.apiQuota().getQuota();
        
        System.out.println("Quota: " + quota.quota);
        System.out.println("Remaining: " + quota.remaining);
        System.out.println("Reset: " + quota.reset);
        
    } catch (MailerSendException e) {
        
        e.printStackTrace();
    }
}

More examples

require "mailersend-ruby"

ms_api_quota = Mailersend::ApiQuota.new
ms_api_quota.get

More examples

Responses

Valid

{
  "quota": 1000,
  "remaining": 752,
  "reset": "2023-04-15T00:00:00Z"
}

Error

Response Code: 401 Unathorized

See - Validation errors

On this page