---
updatedAt: 2026-09-15T14:05:40.000Z
---

Fetch the complete documentation index at: https://docs.baselayer.com/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# Nevermined: Agentic Payments

Enable AI agents to access Baselayer autonomously on a pay-per-use basis 

> Autonomous agents can purchase a Baselayer API key and run real business searches, paying per request via [Nevermined's](https://nevermined.ai) card delegation. No Baselayer account or human sign-up is required.

This page is an agent-facing integration guide. It covers (1) the one-time Nevermined payment setup and (2) the Baselayer endpoints you can buy and call.

## Environment

* **Baselayer agentic API base URL:** `https://api.baselayer.com`
* **Nevermined environment:** `https://api.live.nevermined.app`. Nevermined API keys for this network start with `live`.
* **Payment scheme:** `nvm:card-delegation` (credit or debit card using Nevermined's card delegation)
* **Payment plan:** Baselayer Startup: $10.00 per 100 credits ([plan details](https://api.live.nevermined.app/api/v1/protocol/plans/64016128970723825062202451177754352720194073054658343333156009220723821177122))
* **Agent listing:** [Baselayer Business Search Agent](https://api.live.nevermined.app/api/v1/protocol/agents/60798063874007247008401413456869371418449913824213519077458224260713519377086)

## One-time payment setup

**All payments go through Nevermined's card delegation flow, built on the x402 protocol. Never call Stripe or any other payment API directly.**

A human is needed  to create your Nevermined API key and to enroll a card. Everything after that is programmatic and reusable.

1. **Get a Nevermined API key.** A human signs in once at <https://nevermined.app> and creates an API key for the live environment (starts with `live`). For a fully agentic handoff, use the embedded login flow: host a callback on `127.0.0.1` and send your<br />human to `https://nevermined.app/auth/cli?callback_url=http://127.0.0.1:<port>/callback` . The key is delivered to your callback. Store it and send it as<br />`Authorization: Bearer <api-key>` on every Nevermined call.
2. **Enroll a card (one-time, human required).** Either directly in the<br />Nevermined app (Payment Methods → Enroll card), or via the embedded<br />flow: mint a session with `POST https://api.live.nevermined.app/api/v1/embed/session`
   (`{"returnUrl": "http://127.0.0.1:<port>/callback"}`), then send your<br />human to `https://embed.nevermined.app/cards/setup?sessionToken=<token>&returnUrl=...&state=<random>&provider=stripe`.
3. **Create a spending delegation** (programmatic):
   `POST https://api.live.nevermined.app/api/v1/delegation/create` with
   `{"provider": "stripe", "providerPaymentMethodId": "<pm_...>","spendingLimitCents": 10000, "durationSecs": 604800,"currency": "usd"}`. A delegation authorizes spending within a budget<br />and time window. Reuse it until spent or expired.
4. **Mint an x402 access token** (programmatic, repeatable):
   `POST https://api.live.nevermined.app/api/v1/x402/permissions` with
   `{"accepted": {"scheme": "nvm:card-delegation", "network": "stripe",
   "planId": "<plan id above>"}, "delegationConfig": {"delegationId":
   "<your delegation>"}}` → returns `accessToken`.

You do **not** call `settle` yourself for Baselayer. Our endpoints verify and settle server-side on every request. Your card is charged per request through your delegation; the settlement receipt comes back base64-encoded in the `payment-response` response header.

## Buying and using Baselayer

Both endpoints require the x402 token in the `payment-signature` header. Calling them without it returns **HTTP 402** with a base64 `payment-required` challenge header describing the plan. Decode it to discover everything you need programmatically.

### 1. Purchase an API key: `POST /alpha/api_keys`

```http
POST https://api.baselayer.com/alpha/api_keys
Content-Type: application/json
payment-signature: <x402 access token>

{"name": "my-agent", "default_request_mode": "sync"}
```

Response `201`:

```json
{
  "id": "…",
  "name": "my-agent",
  "key": "prod_…",
  "default_request_mode": "sync"
}
```

Store `key` — it is a real Baselayer production API key.

### 2. Run a business search: `POST /alpha/searches`

Send both your x402 token (pays for the request) and your purchased key (identifies you):

```http
POST https://api.baselayer.com/alpha/searches
Content-Type: application/json
payment-signature: <x402 access token>
X-API-Key: prod_…
Prefer: wait=120

{"name": "Howard Concrete Pumping Co Inc",
 "address": "2327 Hill Church Houston Rd, Canonsburg PA 15317"}
```

Response `201` (synchronous, full results in-line): SOS registrations, officers, watchlist screening, and match verdicts such as `"business_name_match": "EXACT"`. Optional request fields include `officer_names`, `website`, `phone_number`, `email`, and `tin` — see Baselayer's [Search API reference](https://docs.baselayer.com/reference) for the complete schema.

### Python example

```python
import httpx
from payments_py import Payments
from payments_py.common.types import PaymentOptions
from payments_py.x402.types import DelegationConfig, X402TokenOptions

PLAN_ID = "64016128970723825062202451177754352720194073054658343333156009220723821177122"
AGENT_ID = "60798063874007247008401413456869371418449913824213519077458224260713519377086"
BASE = "https://api.baselayer.com"

payments = Payments.get_instance(
    PaymentOptions(nvm_api_key="live:…", environment="live")
)
card = payments.delegation.list_payment_methods(provider="stripe")[0]
delegation = payments.delegation.create_delegation(...)  # step 3 above
token = payments.x402.get_x402_access_token(
    PLAN_ID,
    AGENT_ID,
    token_options=X402TokenOptions(
        scheme="nvm:card-delegation",
        delegation_config=DelegationConfig(delegation_id=delegation.delegation_id),
    ),
)["accessToken"]

key = httpx.post(
    f"{BASE}/alpha/api_keys",
    json={"name": "my-agent", "default_request_mode": "sync"},
    headers={"payment-signature": token},
).json()["key"]

results = httpx.post(
    f"{BASE}/alpha/searches",
    json={"name": "Acme Corp", "address": "1 Main St, Dover, DE"},
    headers={"payment-signature": token, "X-API-Key": key, "Prefer": "wait=120"},
    timeout=180,
).json()
```

## Errors

* **402 +&#x20;**`payment-required`**&#x20;header**: missing, invalid, or exhausted<br />payment token. Decode the header, (re)mint a token, retry.
* **404 within&#x20;**`/alpha`: only the two endpoints above are served.
* You are only charged for successful (2xx) requests.

## Reference

* [Nevermined x402 documentation](https://nevermined.ai/docs/)
* [Nevermined SDK + API docs index](https://nevermined.ai/docs/llms.txt)
* [Baselayer discovery listing on Nevermined](https://api.live.nevermined.app/api/v1/organizations/org-a3c3315e-bd43-4764-8d20-6258cee652b8/agentic-instructions.md)
* [Baselayer API reference](https://docs.baselayer.com/reference)