VayuDocumentationIntegrationsAPI ReferenceChange Log
SupportGet started now
API EndpointsCredits

Create a one-off invoice to top up a customer with credits

This endpoint creates a one-off invoice that bills a customer for a credit grant. Submit the customer ID and the credit grant (credit product, amount, type and price) in the request body — the same credit grant shape used when defining grants on a contract. The grant's price is charged on the invoice, and the credits are granted to the customer when the invoice is approved.

POST
/credits/top-up

Authorization

BearerAuthorizer
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

customerId*string

The ID of the customer to be billed for the credit top-up.

creditGrant*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/credits/top-up" \  -H "Content-Type: application/json" \  -d '{    "customerId": "string",    "creditGrant": {      "name": "string",      "creditProductId": "string",      "balanceKind": "MONETARY",      "grantAmount": 0,      "schedule": "ONE_TIME"    }  }'
{  "invoiceId": "string",  "customerId": "string"}
{  "type": "invalid_request_error",  "code": "string",  "message": "string",  "param": "string",  "params": [    {      "param": "string",      "message": "string"    }  ]}
{  "type": "authentication_error",  "code": "authentication_failed",  "message": "string"}
{  "type": "rate_limit_error",  "code": "rate_limit_exceeded",  "message": "string"}
{  "type": "api_error",  "code": "internal_error",  "message": "string"}