GET /api/static/usage

Check your current API quota and usage information.

Request

Headers:
  • x-api-key (required): Your Rafter API key
Example:
curl -H "x-api-key: RFabc-your-api-key-here" \
  https://rafter.so/api/static/usage

Response

Success (200 OK):
{
  "quota": {
    "can_scan": true,
    "remaining_scans": 5,
    "scans_limit": 10,
    "period": "monthly",
    "reset_date": "2024-02-01T00:00:00Z"
  }
}
Error (401 Unauthorized):
{
  "error": "Invalid or inactive API key."
}
Error (400 Bad Request):
{
  "error": "Missing API key."
}

Response Fields

FieldTypeDescription
quota.can_scanbooleanWhether you can perform scans
quota.remaining_scansintegerNumber of scans remaining in current period
quota.scans_limitintegerTotal scan limit for current period
quota.reset_datestringISO 8601 formatted date when quota resets

Common Scenarios

Quota Available

{
  "quota": {
    "can_scan": true,
    "remaining_scans": 5,
    "scans_limit": 10,
    "reset_date": "2025-07-24T00:00:00.000+00:00"
  }
}

Quota Exceeded

{
  "quota": {
    "can_scan": false,
    "remaining_scans": 0,
    "scans_limit": 10,
    "reset_date": "2025-07-30T00:00:00.000+00:00"
  }
}

Rate Limiting

The API implements rate limiting to ensure fair usage:
  • Rate Limit: 100 requests per minute per IP address
  • Quota: Based on your subscription plan

Examples

JavaScript

const response = await fetch('https://rafter.so/api/static/usage', {
  headers: {
    'x-api-key': 'RFabc-your-api-key-here'
  }
});

const data = await response.json();
console.log(`Remaining scans: ${data.quota.remaining_scans}`);

Python

import requests

response = requests.get(
    'https://rafter.so/api/static/usage',
    headers={'x-api-key': 'RFabc-your-api-key-here'}
)

data = response.json()
print(f"Remaining scans: {data['quota']['remaining_scans']}")

Go

package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {
    req, _ := http.NewRequest("GET", "https://rafter.so/api/static/usage", nil)
    req.Header.Set("x-api-key", "RFabc-your-api-key-here")
    
    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()
    
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}

Shell

#!/bin/bash

API_KEY="RFabc-your-api-key-here"
RESPONSE=$(curl -s -H "x-api-key: $API_KEY" \
  https://rafter.so/api/static/usage)

REMAINING=$(echo $RESPONSE | jq -r '.quota.remaining_scans')
echo "Remaining scans: $REMAINING"