Skip to main content
POST
/
record-usage
Record Usage
curl --request POST \
  --url https://api.example.com/record-usage \
  --header 'Content-Type: application/json' \
  --data '
{
  "api_key": "<string>",
  "source": "<string>",
  "count": 123,
  "metadata": {}
}
'
{
  "success": true,
  "records_created": 123
}

Overview

Record API usage for tracking purposes without deducting credits. This is useful for scenarios like Shopify payments where you want to track usage separately from credit consumption.

Request Body

api_key
string
required
Your GistMag API key
source
string
default:"api"
Source of the usage (e.g., “api”, “shopify”, “wordpress”)
count
number
default:"1"
Number of usage records to create
metadata
object
Additional metadata to store with the usage record

Example Request

curl -X POST https://api.gistmag.co.uk/record-usage \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key_here",
    "source": "shopify",
    "count": 1,
    "metadata": {
      "order_id": "12345",
      "product_id": "67890"
    }
  }'

Response

success
boolean
Whether the usage was recorded successfully
records_created
number
Number of usage records created

Example Response

{
  "success": true,
  "records_created": 1
}

Use Cases

  • Track usage from external integrations (Shopify, WordPress, etc.)
  • Record usage for analytics without consuming credits
  • Monitor API usage across different sources
This endpoint records usage but does NOT deduct credits. Credits are only deducted when using the actual API endpoints like /generate or /tts.
Usage records created through this endpoint will appear in your usage statistics but won’t affect your credit balance.