Quick Start

Solenoid APIs let you add usage metering, feature flags, and infrastructure primitives to any application with a single HTTP call.

Prerequisites

Get an API key from solenoid.systems/pricing. Your key is prefixed with sm_ and should be kept secure.

Base URL

https://api.solenoid.systems

Authentication

Include your API key in the Authorization header:

Authorization: Bearer sm_your_api_key_here

Check a Meter Balance

Meters are multi-tenant — each meterId tracks an end-user’s credits independently.

curl https://api.solenoid.systems/v1/meter/user-123/balance \
  -H "Authorization: Bearer sm_your_api_key_here"
const res = await fetch('https://api.solenoid.systems/v1/meter/user-123/balance', {
  headers: { 'Authorization': 'Bearer sm_your_api_key_here' }
})
const data = await res.json()

Response (200):

{
  "balance": 500,
  "meter_id": "user-123"
}

Deduct Credits

Atomically deduct credits from an end-user meter. Returns 402 if the balance is insufficient.

curl -X POST https://api.solenoid.systems/v1/meter/user-123/deduct \
  -H "Authorization: Bearer sm_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"amount": 5}'
const res = await fetch('https://api.solenoid.systems/v1/meter/user-123/deduct', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sm_your_api_key_here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ amount: 5 })
})
const data = await res.json()

Success (200):

{
  "balance": 495,
  "meter_id": "user-123"
}

Insufficient balance (402):

{
  "error": {
    "code": "insufficient_balance",
    "message": "Insufficient balance for this operation"
  },
  "balance": 0,
  "meter_id": "user-123"
}

Next Steps