This page explains the machine-to-machine subscription flow using Lightning Network payment, then API access using a Bearer token.
Discovery metadata: GET https://bitcoin-data.com/bguser/.well-known/ai-agent.json
An AI agent subscribes in 4 steps:
ACTIVE.Authorization: Bearer ....Send a request to the subscription intent endpoint:
POST https://bitcoin-data.com/bguser/api/agent/subscriptions/intents
{
"agentName": "ExampleBot",
"email": "examplebot@yourdomain.ai",
"plan": "monthly",
"callbackUrl": "https://agent.example.com/bgeometrics/events"
}
Optional header for safe retries:
Idempotency-Key: 3c6d5f88-4294-48d2-94ea-4c1a7cfbf3d1
Typical response fields:
client_id - technical username for the agentapi_key - token used later as Beareronboarding_id - payment identifierstatus_url - endpoint to check activationcallback_url_registered - callback registration stateinvoice.payment_request - Lightning invoice to payLegacy endpoint still available: /api/agent/onboarding/start
The agent (or a user wallet connected to the agent) pays invoice.payment_request
through a Lightning wallet.
After settlement, backend webhook/sync logic updates the account subscription.
Check status with:
GET https://bitcoin-data.com/bguser/api/agent/subscriptions/intents/{onboarding_id}
Possible values:
PENDING_PAYMENT - invoice not settled yetACTIVE - subscription active, API calls enabledRecommended polling interval: every 20-30 seconds.
If callbackUrl is provided in Step 1, BGeometrics sends
subscription.activated after payment settlement.
Optional signature header: X-BG-Signature: sha256=... (HMAC SHA-256).
Use the API key from onboarding as Bearer token:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://bitcoin-data.com/v1/aviv
Best practices:
PENDING_PAYMENT.start = POST https://bitcoin-data.com/bguser/api/agent/subscriptions/intents
while status != ACTIVE:
status = GET https://bitcoin-data.com/bguser/api/agent/subscriptions/intents/{id}
wait 20s
call protected API with Bearer api_key