v1

latestOpenAPI 3.1.02026-07-24230114.4 KB

Create Token

Create a kya, pay, or kya-pay token as a buyer agent.

post/api/v1/tokens

Request body

typestring required

One of kya, pay, or kya-pay. The created token will contain JWT header typ set to <type>+jwt.

buyerTagstring

Buyer’s internal identifier for the token. e.g. "research-agent-xyz"

tokenAmountstring

The amount of funds in currency units allocated to the token. Determines the maximum amount the seller can charge. Must include if this is a payor kya-pay token. For successful token creation, this value must be:

  • Greater than 0
  • Less than or equal to the buyer agent wallet balance
  • Greater than or equal to the seller service minimum token amount (if applicable)

If these conditions are not met, the token creation request will fail.

sellerServiceIdstring

ID of an onboarded seller service. Obtain this from the Skyfire Directory. Required when creating a token for an onboarded seller.

sellerDomainOrUrlstring

Domain name or full URL of an external seller. The buyer agent must belong to an organization and authenticate using an Organization Buyer API Key. Required when creating a token for an external seller.

expiresAtinteger

Unix timestamp (seconds) representing when the token expires. Provide an absolute epoch time, not a relative duration. If omitted, defaults to the maximum allowed lifetimes:

  • 24 hours from now when using sellerServiceId
  • 5 minutes from now when using sellerDomainOrUrl

Must be between 10s and the maximum allowed lifetime for the selected target type.

identityPermissionsstring[]

Default: empty array. Can be specified if this is a kya or kya-pay token. Additional identity fields to include in the token. See https://docs.skyfire.xyz/reference/identity-fields for more info.

Response

200

tokenstring

Example response

{
  "token": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjAiLCJ0eXAiOiJreWErcGF5K0pXVCJ9.eyJlbnYiOiJxYSIsImJ0ZyI6ImVmZDhhNmVlLWM3YjYtNGQyNi05ZTVjLTNiNWU5YzE4MGRmNiIsInNzaSI6IjM1MGQ0MzNkLTZlZDQtNDQ4Mi1iY2ZjLTE0YjdkYTgwN2Y5YiIsImJpZCI6eyJuYW1lRmlyc3QiOiJBTEVYQU5ERVIgSiIsIm5hbWVNaWRkbGUiOiJudWxsIiwibmFtZUxhc3QiOiJTQU1QTEUiLCJiaXJ0aGRhdGUiOiIxOTc3LTA3LTE3IiwicGhvbmVOdW1iZXIiOiIrM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