---
title: "Create a spending delegation and return a signed JWT token"
method: POST
path: "/delegation/create"
tags: ["Delegation"]
---

# Create a spending delegation and return a signed JWT token

`POST /delegation/create`

## Request

- Base URL: `https://api.sandbox.nevermined.app/api/v1`
- URL: `https://api.sandbox.nevermined.app/api/v1/delegation/create`
- Auth: HTTP bearer

Creates a spending delegation for the authenticated user against a previously enrolled payment method. For fiat-backed delegations (stripe/braintree/visa) the response includes a signed JWT (`delegationToken`); for crypto (erc4337) flows the token is held client-side and omitted. Requires a Nevermined API key.

## Request body

- CreateDelegationDto
  - `provider` 'stripe' | 'erc4337' | 'braintree' | 'visa' | 'vgs', required: Payment provider type. `stripe` / `braintree` / `visa` / `erc4337` select that rail directly. `vgs` (epic #1958) is a unified VGS-Collect card: a PLAN-AGNOSTIC, portable delegation whose settlement PSP (`stripe` / `braintree`) is resolved AT CHARGE TIME from the plan being paid (`fiatPaymentProvider`), so ONE card can charge ANY PSP (#2082). `delegation.provider` is persisted as the portable `vgs` marker (the concrete charge never sees it — the handler derives the real PSP at settle). Requires a portable `providerPaymentMethodId` (the `CRD…` cardId, which must carry an active network token); `planId` is OPTIONAL — pass it only to BIND the delegation to a single plan.
  - `providerPaymentMethodId` string: Payment-method identifier from the provider. For stripe / braintree this is the saved card; for visa this is the VGS agentic-token id returned by enrollment; for vgs this is the `CRD…` canonical cardId from the unified VGS-Collect enroll. Required for these providers; ignored for erc4337.
  - `consumerPrompt` string: Visa-only: human-readable approval prompt shown to the user during VGS Agentic Auth device binding. Required when provider=visa.
  - `assuranceData` object: Visa-only: opaque assurance payload from the VGS Agentic Auth browser SDK after FIDO/OTP device binding. Required when provider=visa.
  - `spendingLimitCents` number, required: Maximum spending limit in cents (smallest currency unit)
  - `durationSecs` number, required: Duration of the delegation in seconds
  - `currency` 'usd' | 'eur' | 'usdc' | 'eurc', required: Currency code (lowercase)
  - `planId` string: Plan ID to restrict this delegation to. Optional and plan-agnostic by default (#1534), INCLUDING provider=vgs (#2082): a unified VGS card delegation is plan-agnostic and the settlement PSP is resolved at charge time from the plan being paid, so one card can charge any PSP — pass planId only to BIND it to a single plan. EXCEPT provider=visa (the VGS mandate is merchant-scoped, derived from the plan owner; see BCK.VISA.0015), where it is REQUIRED.
  - `maxTransactions` number: Maximum number of transactions allowed (null = unlimited)
  - `apiKeyId` string: Optional API Key ID (skId) to restrict this delegation to
  - `allowedRecipients` string[]: erc4337 / Router only: restrict spend to these pay-to addresses — the Router rejects payments to any other recipient. Omit for no recipient restriction.
  - `organizationWalletId` string: erc4337 / Router only (#2230): fund this delegation from an ORGANIZATION wallet instead of the caller's own wallet. The caller must be an admin of the wallet's org. Spend is always capped by the SPENDING member's group budget (the wallet must be shared with the member's group).

## Response `201`

The created delegation

- CreateDelegationResponseDto
  - `delegationId` string, required
  - `delegationToken` string, nullable: Signed JWT for fiat-backed delegations (stripe/braintree). Omitted for crypto (erc4337) flows where the signed delegation is held client-side.

## Other responses

- `401`: Unauthorized

---

[API](https://skmtc.dev/nevermined/apis/nevermined-api.md) · [All operations](https://skmtc.dev/nevermined/apis/nevermined-api/llms.txt) · [OpenAPI document](https://skmtc.dev/nevermined/apis/nevermined-api/revisions/cabbe618c80b?raw)
