Skip to main content

Enterprise API Reference

The Enterprise API lets you integrate Singularity Layer directly into your platform. Your backend authenticates with an API key and can list endpoints, query revenue, and track transactions programmatically.

Get Partner Config

Retrieve your pricing overrides and revenue split percentages.

List Endpoints

View all endpoints deployed through your enterprise program.

Revenue Stats

Aggregated revenue summary with three-way split totals.

Transaction Ledger

Full payment history with per-transaction split details.

Authentication

All Enterprise API requests require an API key passed via the X-Enterprise-Key header:
curl https://studio.x402layer.cc/api/v1/enterprise \
  -H "X-Enterprise-Key: sgl_ent_your_api_key_here"

Getting an API Key

  1. Go to your Enterprise Dashboard
  2. Navigate to API Keys
  3. Click Create Key
  4. Copy the key — it is only shown once
Keys use the sgl_ent_ prefix. You can create up to 10 active keys per partner. Keys can be set to expire after 30, 90, or 365 days, or never.

Base URL

https://studio.x402layer.cc/api/v1/enterprise

Code Examples

Quick integration examples in TypeScript and Python.

TypeScript — List Endpoints

const API_KEY = process.env.ENTERPRISE_API_KEY;
const BASE = "https://studio.x402layer.cc/api/v1/enterprise";

const res = await fetch(`${BASE}/endpoints?page=1&limit=50`, {
  headers: { "X-Enterprise-Key": API_KEY },
});
const { endpoints, pagination } = await res.json();

for (const ep of endpoints) {
  console.log(ep.slug, ep.owner_credits, ep.is_active ? "active" : "paused");
}

Python — Query Revenue Stats

import os, requests

API_KEY = os.environ["ENTERPRISE_API_KEY"]
BASE = "https://studio.x402layer.cc/api/v1/enterprise"

stats = requests.get(
    f"{BASE}/stats",
    headers={"X-Enterprise-Key": API_KEY},
).json()

print(f"Total revenue: ${stats['total_revenue']:.2f}")
print(f"Your earnings: ${stats['enterprise_earned']:.2f}")
print(f"Pending payout: ${stats['pending_payout']:.2f}")

TypeScript — Verify Webhook Signature

import { createHmac } from "crypto";

function verifyWebhook(rawBody: string, headers: Record<string, string>, secret: string): boolean {
  const signature = headers["x-x402-signature"];
  const timestamp = headers["x-x402-timestamp"];
  if (!signature || !timestamp) return false;

  const expected = createHmac("sha256", secret)
    .update(timestamp + "." + rawBody)
    .digest("hex");

  return signature === expected;
}

// In your webhook handler:
app.post("/webhooks/singularity", (req, res) => {
  if (!verifyWebhook(req.rawBody, req.headers, process.env.WEBHOOK_SECRET)) {
    return res.status(401).send("Invalid signature");
  }
  const event = JSON.parse(req.rawBody);
  console.log(event.event, event.source_slug, event.amount);
  res.status(200).send("ok");
});

Worker API (Endpoint Creation)

When agents on your platform deploy endpoints, they call the Singularity worker API. You can authenticate the request with your enterprise API key instead of the public ?partner=slug parameter:
curl -X POST https://api.x402layer.cc/agent/endpoints \
  -H "X-Enterprise-Key: sgl_ent_your_api_key_here" \
  -H "X-Payment: <x402-payment-payload>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Agent API",
    "url": "https://my-agent.com/api",
    "description": "Agent-powered data analysis",
    "chain": "base",
    "pricing_model": "credit",
    "category": "AI Tools"
  }'
The X-Enterprise-Key header replaces ?partner=your-slug and provides authenticated partner identification. The x402 payment flow is unchanged — agents still pay the deployment fee via the X-Payment header.

Topup (Credit Recharge)

curl -X PUT "https://api.x402layer.cc/agent/endpoints?slug=my-agent-api&action=topup" \
  -H "X-Enterprise-Key: sgl_ent_your_api_key_here" \
  -H "X-Payment: <x402-payment-payload>"

MCP Server

For agent-native integration, your agents can also connect to the Singularity MCP server directly: Endpoint: https://mcp.x402layer.cc/mcp Pass your enterprise slug as a parameter in MCP tool calls:
{
  "enterprise_partner_slug": "your-slug"
}
This routes the action through your enterprise program with the same revenue split and pricing overrides.

Error Responses

All errors follow a consistent format:
{
  "error": "Description of what went wrong"
}
StatusMeaning
401Missing or invalid API key
403Insufficient scope
404Resource not found
429Rate limited (120 requests/minute per partner)
500Server error

Rate Limits

Enterprise API requests are rate-limited to 120 requests per minute per partner. This limit applies across all API keys for the same partner. If you exceed the limit, you’ll receive a 429 Too Many Requests response.