Fuel API (1.0.0)

Download OpenAPI specification:

API for credit and wallet management.

Node.js / Edge SDK

The official server SDK is available at https://www.npmjs.com/package/@underspark/fuel-node.

Authentication

All API requests require an API Key. Include it in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Getting an API Key

  1. Sign in to the UnderSpark Developer Console
  2. Select an organization and open Fuel API
  3. Create the Fuel API database, then generate a key from API Keys

認証 (日本語)

すべてのAPIリクエストにはAPIキーが必要です。Authorizationヘッダーに含めてください:

Authorization: Bearer YOUR_API_KEY

APIキーの取得方法

  1. UnderSpark Developer Console にサインイン
  2. Organizationを選択して Fuel API を開く
  3. Fuel API用DBを作成し、API Keys からキーを発行

/v1/users

Authorizations:
BearerAuth
Request Body schema: application/json
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
email
string <email>
name
string
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "email": "user@example.com",
  • "name": "string",
  • "metadata": {
    }
}

Response samples

Content type
application/json
{
  • "userId": "string",
  • "metadata": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "isNew": true
}

/v1/wallets/{id}

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123

Responses

Response samples

Content type
application/json
{
  • "buckets": [
    ],
  • "events": [
    ]
}

/v1/wallets/{id}/charge

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123
Request Body schema: application/json
amount
required
number >= 1
reason
required
string
object
property name*
additional property
any
actor
string

Responses

Request samples

Content type
application/json
{
  • "amount": 1,
  • "reason": "string",
  • "metadata": {
    },
  • "actor": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "deducted": 0,
  • "remainingBalance": 0,
  • "details": [
    ]
}

/v1/wallets/{id}/reserve

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123
Request Body schema: application/json
amount
required
number >= 1
reason
required
string
ttl
number
object
property name*
additional property
any
actor
string

Responses

Request samples

Content type
application/json
{
  • "amount": 1,
  • "reason": "string",
  • "ttl": 0,
  • "metadata": {
    },
  • "actor": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "reservationId": "string",
  • "expiresAt": "2019-08-24T14:15:22Z"
}

/v1/wallets/{id}/commit

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123
Request Body schema: application/json
reservationId
required
string
amount
number

Responses

Request samples

Content type
application/json
{
  • "reservationId": "string",
  • "amount": 0
}

Response samples

Content type
application/json
{
  • "success": true,
  • "deducted": 0,
  • "remainingBalance": 0
}

/v1/wallets/{id}/rollback

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123
Request Body schema: application/json
reservationId
required
string

Responses

Request samples

Content type
application/json
{
  • "reservationId": "string"
}

Response samples

Content type
application/json
{
  • "success": true
}

/v1/wallets/{id}/balance

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123

Responses

Response samples

Content type
application/json
{
  • "balance": 1500
}

/v1/wallets/{id}/grant

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123
Request Body schema: application/json
amount
required
number >= 1
reason
required
string
expiresAt
string <date-time>
sourceType
string
object
property name*
additional property
any
actor
string

Responses

Request samples

Content type
application/json
{
  • "amount": 1,
  • "reason": "string",
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "sourceType": "string",
  • "metadata": {
    },
  • "actor": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "bucketId": "string",
  • "granted": 0,
  • "expiresAt": "2019-08-24T14:15:22Z"
}

/v1/wallets/{id}/cleanup

Authorizations:
BearerAuth
path Parameters
id
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Example: user_123

Responses

Response samples

Content type
application/json
{
  • "success": true
}

/v1/campaigns

Authorizations:
BearerAuth
Request Body schema: application/json
name
required
string
triggerEvent
required
string
rewardType
required
string
Enum: "fixed_amount" "percent"
rewardValue
required
number
rewardAsset
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "triggerEvent": "string",
  • "rewardType": "fixed_amount",
  • "rewardValue": 0,
  • "rewardAsset": "string"
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "name": "string",
  • "triggerEvent": "string",
  • "rewardType": "fixed_amount",
  • "rewardValue": 0,
  • "rewardAsset": "string",
  • "isActive": true,
  • "createdAt": "2019-08-24T14:15:22Z"
}

/v1/campaigns

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/v1/referral-codes

Authorizations:
BearerAuth
Request Body schema: application/json
code
required
string
campaignId
number
object
property name*
additional property
any
userId
required
string

Responses

Request samples

Content type
application/json
{
  • "code": "string",
  • "campaignId": 0,
  • "metadata": {
    },
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "code": "string",
  • "userId": "string",
  • "campaignId": 0,
  • "metadata": {
    },
  • "isActive": true,
  • "createdAt": "2019-08-24T14:15:22Z"
}

/v1/referral-codes

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/v1/track/click

Authorizations:
BearerAuth
Request Body schema: application/json
referralCode
required
string
url
string
referrer
string
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "referralCode": "string",
  • "url": "string",
  • "referrer": "string",
  • "metadata": {
    }
}

Response samples

Content type
application/json
{
  • "success": true
}

/v1/track/conversion

Authorizations:
BearerAuth
Request Body schema: application/json
referralCode
required
string
uniqueId
required
string
eventType
required
string
amount
number
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "referralCode": "string",
  • "uniqueId": "string",
  • "eventType": "string",
  • "amount": 0,
  • "metadata": {
    }
}

Response samples

Content type
application/json
{
  • "success": true,
  • "rewardId": 0
}

/v1/affiliates/{id}/stats

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "clicks": 0,
  • "conversions": 0,
  • "totalEarned": 0,
  • "pendingPayout": 0
}

/v1/affiliates/{id}/conversions

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/v1/affiliates/{id}/rewards

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/v1/affiliates/{id}/payouts/request

Authorizations:
BearerAuth
Request Body schema: application/json
amount
required
number >= 1

Responses

Request samples

Content type
application/json
{
  • "amount": 1
}

Response samples

Content type
application/json
{
  • "success": true,
  • "payoutId": 0
}

/v1/campaigns/stats

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "activeCampaigns": 0,
  • "totalConversions": 0,
  • "totalRewards": 0,
  • "pendingPayouts": 0
}

/v1/conversions

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/v1/points/{userId}/grant

Authorizations:
BearerAuth
path Parameters
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Request Body schema: application/json
amount
required
number > 0
reason
required
string non-empty
tag
string
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "amount": 100,
  • "reason": "Daily login bonus",
  • "tag": "login_bonus"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "balance": 0,
  • "granted": 0
}

/v1/points/{userId}/spend

Authorizations:
BearerAuth
path Parameters
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
Request Body schema: application/json
amount
required
number > 0
reason
required
string non-empty
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "amount": 50,
  • "reason": "Item purchase"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "balance": 0,
  • "spent": 0
}

/v1/points/{userId}/balance

Authorizations:
BearerAuth
path Parameters
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$

Responses

Response samples

Content type
application/json
{
  • "balance": 1500,
  • "totalEarned": 2000,
  • "totalSpent": 500,
  • "lastEarnedAt": "2025-01-15T10:30:00Z",
  • "lastSpentAt": "2025-01-14T08:00:00Z",
  • "expiresAt": null
}

/v1/points/{userId}/events

Authorizations:
BearerAuth
path Parameters
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
query Parameters
limit
number or null
Default: 50
offset
number or null
Default: 0
tag
string

Responses

Response samples

Content type
application/json
{
  • "events": [
    ],
  • "total": 0
}

/v1/points/{userId}/stats

Authorizations:
BearerAuth
path Parameters
userId
required
string [ 1 .. 128 ] characters ^[a-zA-Z0-9_-]+$
query Parameters
from
string
to
string

Responses

Response samples

Content type
application/json
{
  • "stats": [
    ]
}