Agency

Export Agency Usage Report

get

Export credit usage data for all sub-accounts as a CSV file.

Requires Agency or Dev role. This endpoint only accepts apiKey authentication (userId is not supported).

Returns a downloadable CSV file with columns: Sub Account ID, Sub Account Email, Sub Account Name, Date, Amount, Reason, Campaign Name, Contact Name, Credit Type, Custom Keys Used, Description, AI Model.

Authorizations
apiKeystringRequired

Your DM Champ API key. Obtain from Settings → API Keys.

Query parameters
apiKeystringOptional

API key for authentication. At least one of apiKey or userId is required for protected endpoints.

Example: your_api_key
fromstring · dateOptional

Start date for the report range (YYYY-MM-DD). Defaults to 30 days ago.

Example: 2024-01-01
tostring · dateOptional

End date for the report range (YYYY-MM-DD). Defaults to today.

Example: 2024-01-31
subAccountIdstringOptional

Filter report to a specific sub-account ID. If omitted, all sub-accounts are included.

Example: uid123abc
Responses
chevron-right
200

CSV usage report downloaded successfully

text/csv
stringOptional

CSV file with agency usage data. Headers: Sub Account ID, Sub Account Email, Sub Account Name, Date, Amount, Reason, Campaign Name, Contact Name, Credit Type, Custom Keys Used, Description, AI Model

get
/agencies/usage/export

Agency Public Checkout

get

Creates a Stripe Checkout session for unauthenticated users (prospects) to purchase credits and become sub-accounts of an agency.

This endpoint is public — no authentication required. It is designed for shareable payment links that agencies can distribute to potential sub-accounts.

Flow:

  1. Agency shares the checkout URL with query params agencyId and tierIndex

  2. Endpoint validates params, fetches agency pricing config

  3. Creates a Stripe Checkout session on the agency's own Stripe account (BYOK)

  4. Redirects (303) to the Stripe hosted checkout page

  5. Stripe collects the buyer's email and name

  6. On payment success, a Firebase Auth user and Firestore doc are created automatically

  7. A welcome email with a temporary password is sent to the buyer

Authorizations
apiKeystringRequired

Your DM Champ API key. Obtain from Settings → API Keys.

Query parameters
agencyIdstringRequired

Firebase UID of the agency

Example: fHjQASIIzfUcrvuAvaYWdDd65Bu2
tierIndexintegerRequired

Zero-based index into the agency's credit pricing tiers

Example: 0
Responses
get
/checkout

No content

Last updated

Was this helpful?