curl --request POST \
--url https://api.sandbox.nevermined.app/api/v1/delegation/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "stripe",
"spendingLimitCents": 10000,
"durationSecs": 604800,
"currency": "usd",
"agentId": "<string>",
"label": "<string>",
"providerPaymentMethodId": "pm_1Abc2Def3Ghi4Jkl",
"consumerPrompt": "Allow up to USD 50.00 over 5 transactions",
"assuranceData": {},
"planId": "123456789",
"maxTransactions": 50,
"apiKeyId": "sk-abc123",
"allowedRecipients": [
"0x209693Bc6afc0C5328bA36FaF03C514EF312287C"
],
"allowSessionPayments": false,
"organizationWalletId": "orw-abc123"
}
'import requests
url = "https://api.sandbox.nevermined.app/api/v1/delegation/create"
payload = {
"provider": "stripe",
"spendingLimitCents": 10000,
"durationSecs": 604800,
"currency": "usd",
"agentId": "<string>",
"label": "<string>",
"providerPaymentMethodId": "pm_1Abc2Def3Ghi4Jkl",
"consumerPrompt": "Allow up to USD 50.00 over 5 transactions",
"assuranceData": {},
"planId": "123456789",
"maxTransactions": 50,
"apiKeyId": "sk-abc123",
"allowedRecipients": ["0x209693Bc6afc0C5328bA36FaF03C514EF312287C"],
"allowSessionPayments": False,
"organizationWalletId": "orw-abc123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'stripe',
spendingLimitCents: 10000,
durationSecs: 604800,
currency: 'usd',
agentId: '<string>',
label: '<string>',
providerPaymentMethodId: 'pm_1Abc2Def3Ghi4Jkl',
consumerPrompt: 'Allow up to USD 50.00 over 5 transactions',
assuranceData: {},
planId: '123456789',
maxTransactions: 50,
apiKeyId: 'sk-abc123',
allowedRecipients: ['0x209693Bc6afc0C5328bA36FaF03C514EF312287C'],
allowSessionPayments: false,
organizationWalletId: 'orw-abc123'
})
};
fetch('https://api.sandbox.nevermined.app/api/v1/delegation/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.nevermined.app/api/v1/delegation/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'stripe',
'spendingLimitCents' => 10000,
'durationSecs' => 604800,
'currency' => 'usd',
'agentId' => '<string>',
'label' => '<string>',
'providerPaymentMethodId' => 'pm_1Abc2Def3Ghi4Jkl',
'consumerPrompt' => 'Allow up to USD 50.00 over 5 transactions',
'assuranceData' => [
],
'planId' => '123456789',
'maxTransactions' => 50,
'apiKeyId' => 'sk-abc123',
'allowedRecipients' => [
'0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
],
'allowSessionPayments' => false,
'organizationWalletId' => 'orw-abc123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.nevermined.app/api/v1/delegation/create"
payload := strings.NewReader("{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.nevermined.app/api/v1/delegation/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.nevermined.app/api/v1/delegation/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}"
response = http.request(request)
puts response.read_body{
"delegationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"delegationToken": "eyJhbGciOiJIUzI1NiIsInR..."
}Create Delegation
Creates a spending delegation for the authenticated user against a previously enrolled payment method. For fiat-backed delegations (stripe/visa/vgs) the response includes a signed JWT (delegationToken); for crypto (erc4337) flows the token is held client-side and omitted. Requires a Nevermined API key.
curl --request POST \
--url https://api.sandbox.nevermined.app/api/v1/delegation/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "stripe",
"spendingLimitCents": 10000,
"durationSecs": 604800,
"currency": "usd",
"agentId": "<string>",
"label": "<string>",
"providerPaymentMethodId": "pm_1Abc2Def3Ghi4Jkl",
"consumerPrompt": "Allow up to USD 50.00 over 5 transactions",
"assuranceData": {},
"planId": "123456789",
"maxTransactions": 50,
"apiKeyId": "sk-abc123",
"allowedRecipients": [
"0x209693Bc6afc0C5328bA36FaF03C514EF312287C"
],
"allowSessionPayments": false,
"organizationWalletId": "orw-abc123"
}
'import requests
url = "https://api.sandbox.nevermined.app/api/v1/delegation/create"
payload = {
"provider": "stripe",
"spendingLimitCents": 10000,
"durationSecs": 604800,
"currency": "usd",
"agentId": "<string>",
"label": "<string>",
"providerPaymentMethodId": "pm_1Abc2Def3Ghi4Jkl",
"consumerPrompt": "Allow up to USD 50.00 over 5 transactions",
"assuranceData": {},
"planId": "123456789",
"maxTransactions": 50,
"apiKeyId": "sk-abc123",
"allowedRecipients": ["0x209693Bc6afc0C5328bA36FaF03C514EF312287C"],
"allowSessionPayments": False,
"organizationWalletId": "orw-abc123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'stripe',
spendingLimitCents: 10000,
durationSecs: 604800,
currency: 'usd',
agentId: '<string>',
label: '<string>',
providerPaymentMethodId: 'pm_1Abc2Def3Ghi4Jkl',
consumerPrompt: 'Allow up to USD 50.00 over 5 transactions',
assuranceData: {},
planId: '123456789',
maxTransactions: 50,
apiKeyId: 'sk-abc123',
allowedRecipients: ['0x209693Bc6afc0C5328bA36FaF03C514EF312287C'],
allowSessionPayments: false,
organizationWalletId: 'orw-abc123'
})
};
fetch('https://api.sandbox.nevermined.app/api/v1/delegation/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.nevermined.app/api/v1/delegation/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'stripe',
'spendingLimitCents' => 10000,
'durationSecs' => 604800,
'currency' => 'usd',
'agentId' => '<string>',
'label' => '<string>',
'providerPaymentMethodId' => 'pm_1Abc2Def3Ghi4Jkl',
'consumerPrompt' => 'Allow up to USD 50.00 over 5 transactions',
'assuranceData' => [
],
'planId' => '123456789',
'maxTransactions' => 50,
'apiKeyId' => 'sk-abc123',
'allowedRecipients' => [
'0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
],
'allowSessionPayments' => false,
'organizationWalletId' => 'orw-abc123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.nevermined.app/api/v1/delegation/create"
payload := strings.NewReader("{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.nevermined.app/api/v1/delegation/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.nevermined.app/api/v1/delegation/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"stripe\",\n \"spendingLimitCents\": 10000,\n \"durationSecs\": 604800,\n \"currency\": \"usd\",\n \"agentId\": \"<string>\",\n \"label\": \"<string>\",\n \"providerPaymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\",\n \"consumerPrompt\": \"Allow up to USD 50.00 over 5 transactions\",\n \"assuranceData\": {},\n \"planId\": \"123456789\",\n \"maxTransactions\": 50,\n \"apiKeyId\": \"sk-abc123\",\n \"allowedRecipients\": [\n \"0x209693Bc6afc0C5328bA36FaF03C514EF312287C\"\n ],\n \"allowSessionPayments\": false,\n \"organizationWalletId\": \"orw-abc123\"\n}"
response = http.request(request)
puts response.read_body{
"delegationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"delegationToken": "eyJhbGciOiJIUzI1NiIsInR..."
}Authorizations
Your Nevermined API Key (starts with 'nvm:'). Get one at nevermined.app under Account → API keys.
Body
Payment rail for this delegation. stripe, visa, and erc4337 select that rail directly. vgs is a portable, plan-agnostic card delegation whose settlement processor (Stripe or Braintree) is chosen when a payment is made, based on the plan being paid — so one enrolled card can pay across processors. vgs requires a portable providerPaymentMethodId (the CRD… cardId, which must carry an active network token); for vgs, planId is optional and only restricts the delegation to a single plan.
stripe, erc4337, visa, vgs "stripe"
Currency code (lowercase). A card delegation charges in this currency and nothing converts it, so it can only pay plans priced in the same currency; a card delegation created with planId set in another currency than that plan is refused (BCK.DELEGATION.0011).
usd, eur, usdc, eurc "usd"
Payment-method identifier from the provider. For stripe this is the saved card; for vgs this is the CRD… canonical cardId from the unified VGS-Collect enroll; for visa this is the card’s CRD… cardId (the card must list visa in its rails on GET /payment-methods) or the VGS agentic-token id returned by enrollment. A visa delegation created from the CRD… is stored under the card’s agentic token, so delegation reads return that token id as its providerPaymentMethodId, not the CRD… sent; the visa entry of GET /payment-methods whose id is that token carries the card’s cardId. Required for these providers; ignored for erc4337.
"pm_1Abc2Def3Ghi4Jkl"
erc4337 / Router only: whether this delegation may pay services that sell over an MPP session, which lock a refundable deposit from the wallet at the first call. Defaults to true. Set false to refuse them: a service that also offers a per-call charge over Tempo is paid that way regardless, and a call that has nothing else to pay is refused (409 BCK.ROUTER.0047). A delegation cannot be edited, so this is fixed at creation.
false
erc4337 / Router only: fund this delegation from an organization wallet instead of the caller's own wallet. The caller must be an admin of the wallet's organization, and spending is always capped by the member's group budget (the wallet must be shared with that group).
"orw-abc123"
Response
The created delegation
Was this page helpful?