SudoMock

Account Info

Retrieve your account information, subscription status, usage metrics, and current API key metadata.

GET/api/v1/me

Overview

The /api/v1/me endpoint returns comprehensive information about your account based on the API key used for authentication. This is useful for:

API Key Validation

Verify your API key is valid before making other requests

Credit Monitoring

Check remaining credits before batch operations

Usage Tracking

Monitor API key usage and request counts

CLI Integration

Build CLI tools that display account status

Try It

Test your API key and see your account information:

Test Your API Key

Verify your key works and check account status

Get your API key from the Dashboard

Request

Send a GET request with your API key in the header:

Request
1curl -X GET "https://api.sudomock.com/api/v1/me" \
2 -H "x-api-key: sm_your_api_key_here"

Headers

HeaderRequiredDescription
x-api-keyYesYour SudoMock API key (starts with sm_)

Response

A successful request returns your account details:

Response 200 OK
1{
2 "success": true,
3 "data": {
4 "account": {
5 "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
6 "email": "[email protected]",
7 "name": "Acme Corp",
8 "created_at": "2025-06-15T10:30:00Z"
9 },
10 "subscription": {
11 "plan": "pro-25k",
12 "tier": "pro",
13 "status": "active",
14 "current_period_end": "2026-02-05T00:00:00Z",
15 "billing_channel": "stripe"
16 },
17 "usage": {
18 "credits_used_this_month": 12847,
19 "credits_limit": 50000,
20 "credits_remaining": 37153,
21 "billing_period_start": "2026-01-01T00:00:00Z",
22 "billing_period_end": "2026-02-01T00:00:00Z",
23 "prepaid_balance": 4.30,
24 "prepaid_balance_currency": "USD"
25 },
26 "api_key": {
27 "name": "Production Key",
28 "created_at": "2025-06-15T10:30:00Z",
29 "last_used_at": "2026-01-05T00:25:00Z",
30 "total_requests": 847293
31 }
32 }
33}

Response Fields

account

FieldTypeDescription
uuidstringUnique user identifier
emailstringAccount email address
namestring | nullAccount or company name (if set)
created_atstringAccount creation timestamp (ISO 8601)

subscription

FieldTypeDescription
planstringPlan slug (e.g. free, pro-25k, scale-100k)
tierstringPlan tier for feature gating: free, pro, or scale
statusstringSubscription status: active, cancelled, past_due, expired, paused
current_period_endstring | nullEnd of current billing period (ISO 8601)
billing_channelstringWhere the subscription is billed: stripe, shopify, or none (no active paid subscription)

usage

This object carries two independent numbers. The credits_* fields count a subscription's monthly allowance. prepaid_balance is the money on the account. A pay as you go account has no monthly allowance, so all threecredits_* fields are legitimately 0 while its balance is positive.

FieldTypeDescription
credits_used_this_monthintegerCredits used in current billing period
credits_limitintegerMonthly credit limit based on plan
credits_remainingintegerAvailable credits, server-calculated as max(0, credits_limit - credits_used_this_month)
billing_period_startstringStart of billing period (ISO 8601)
billing_period_endstringEnd of billing period (ISO 8601)
prepaid_balancenumberPrepaid balance remaining, in prepaid_balance_currency. Always present, never null: an account holding no balance reports 0.
prepaid_balance_currencystringISO 4217 currency of prepaid_balance. Always USD today.

Do not alarm on credits alone

A low-balance check that reads only credits_remaining fires permanently on a pay as you go account, which reports 0 there by design. Treat the account as out of funds only when credits_remaining and prepaid_balance are both at zero.

api_key

Information about the API key used to make this request:

FieldTypeDescription
namestringName you gave to this API key
created_atstringWhen the key was created (ISO 8601)
last_used_atstring | nullLast time this key was used (ISO 8601)
total_requestsintegerTotal credit-consuming operations recorded for this key

Error Responses

StatusMessageCause
401Not authenticatedx-api-key header not provided
401Invalid API key formatKey does not start with sm_
401Invalid or revoked API keyKey not found in database or has been revoked
500Internal server errorUnexpected error while fetching account data. Contact support if persistent.
401 Unauthorized Response
1{
2 "success": false,
3 "detail": "Not authenticated"
4}
500 Internal Server Error Response
1{
2 "success": false,
3 "detail": "Internal error while fetching account information"
4}

Use Cases

Pre-Batch Credit Check

Before running a batch of renders, check that the account is funded. Read both numbers: a subscription pays the batch from credits_remaining, a pay as you go account pays it from prepaid_balance.

Funds Check Before Batch
1# Check available funds before batch
2USAGE=$(curl -s "https://api.sudomock.com/api/v1/me" \
3 -H "x-api-key: $SUDOMOCK_API_KEY" | jq '.data.usage')
4
5CREDITS=$(echo "$USAGE" | jq '.credits_remaining')
6BALANCE=$(echo "$USAGE" | jq '.prepaid_balance')
7
8BATCH_SIZE=100
9
10if [ "$CREDITS" -ge "$BATCH_SIZE" ]; then
11 echo "Sufficient credits ($CREDITS). Starting batch..."
12 # Run batch renders
13elif [ "$(echo "$BALANCE > 0" | bc -l)" -eq 1 ]; then
14 echo "Plan credits low, but balance is \$$BALANCE. Starting batch..."
15 # Run batch renders
16else
17 echo "Out of funds. $CREDITS credits and \$$BALANCE balance."
18 exit 1
19fi

CLI Account Status

Build a CLI tool that shows account status:

Python CLI Example
1import requests
2import os
3
4def get_account_status():
5 response = requests.get(
6 "https://api.sudomock.com/api/v1/me",
7 headers={"x-api-key": os.environ["SUDOMOCK_API_KEY"]}
8 )
9 data = response.json()["data"]
10
11 sub = data['subscription']
12 usage = data['usage']
13 print(f"Plan: {sub['plan']} (tier: {sub['tier']})")
14 print(f"Credits: {usage['credits_remaining']:,} remaining")
15 print(f"Balance: {usage['prepaid_balance']:.2f} {usage['prepaid_balance_currency']}")
16 print(f"API Key: {data['api_key']['name']}")
17 print(f"Total Operations: {data['api_key']['total_requests']:,}")
18
19if __name__ == "__main__":
20 get_account_status()

Ready to get started?

Generate your API key and start building.

Get API Key