> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Fee Sponsorship

Gas sponsorship configuration: pay gas for your users or charge it in ERC-20 / SPL tokens.

## List fee sponsorship policies

`GET /v2/fee-sponsorship`

Returns a list of fee sponsorship policies.

Fee sponsorship policies define gas sponsorship rules by linking to a policy
with rich criteria (evmAddress, ethValue, evmNetwork, evmData).

### Query parameters

- `limit` `integer <int32>`: Specifies the maximum number of records to return.
- `skip` `integer <int32>`: Specifies the offset for the first records to return.
- `order` `string`: Specifies the order in which to sort the results.
- `name` `string`: Filter by policy name (partial match).
- `chainId` `integer <int32>`: Filter by chain ID.
- `enabled` `boolean`: Filter by enabled status.
- `deleted` `boolean`: Include deleted policies.

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `object` `string` _(required)_
- `url` `string` _(required)_
- `data` `object[]` _(required)_
  - `id` `string` _(required)_
  - `object` `string` _(required)_
  - `createdAt` `integer <int32>` _(required)_
  - `name` `string | null` _(required)_: Name of the fee sponsorship policy.
  - `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
  - `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
  - `enabled` `boolean` _(required)_: Whether the policy is enabled.
  - `strategy` `object` _(required)_: Sponsorship strategy configuration.
    - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
    - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
    - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
    - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
    - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
  - `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
  - `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
  - `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.
- `start` `integer <int32>` _(required)_
- `end` `integer <int32>` _(required)_
- `total` `integer <int32>` _(required)_

#### `401`: Unauthorized.

### Example request

```bash
curl 'https://api.openfort.io/v2/fee-sponsorship?limit=10&skip=0&order=desc&name=DeFi&chainId=1&enabled=true&deleted=false'
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship?limit=10&skip=0&order=desc&name=DeFi&chainId=1&enabled=true&deleted=false')
```

## Create a fee sponsorship

`POST /v2/fee-sponsorship`

Creates a new fee sponsorship.

This endpoint requires linking to an existing policy via `policyId`.
Create the policy first via `/v2/policies` with your criteria rules.

**Workflow:**
1. Create a policy via `/v2/policies` with criteria rules
2. Create a fee sponsorship with `policyId` linking to that policy

**Supported criteria types:**
- `evmAddress`: Filter by recipient address (in/not in)
- `ethValue`: Filter by ETH amount (<=, >=, <, >)
- `evmNetwork`: Filter by chain ID (in/not in)
- `evmData`: Filter by function selector or parameters

### Request body (required) (`application/json`)

- `name` `string`: Name of the fee sponsorship policy.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract UUID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `splTokens` `string[]`: SPL mint addresses (base58) accepted as fee payment for Solana charge_custom_tokens policies. Solana-only; mutually exclusive with tokenContract / tokenContractAmount.
- `paymaster` `string`: Paymaster UUID (optional, for pay_for_user schema).
- `chainId` `integer <int32>`: Chain ID for single-chain sponsorship.
- `forwarderContractId` `string`: Forwarder contract UUID (optional, for meta-transactions).
- `policyId` `string` _(required)_: Link to a policy for criteria-based transaction filtering. Create the policy first via /v2/policies, then reference it here.

### Responses

#### `201`: Created.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `createdAt` `integer <int32>` _(required)_
- `name` `string | null` _(required)_: Name of the fee sponsorship policy.
- `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
- `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
- `enabled` `boolean` _(required)_: Whether the policy is enabled.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
  - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
- `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
- `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
- `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.

#### `400`: Bad request.

#### `401`: Unauthorized.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "My DeFi Gas Sponsorship",
  "strategy": {
    "sponsorSchema": "pay_for_user",
    "tokenContract": "con_48eeba57-2cd5-4159-a2cb-057a23a35e65",
    "tokenContractAmount": "1000000000000000000",
    "splTokens": [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    ]
  },
  "paymaster": "pay_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "chainId": 8453,
  "forwarderContractId": "cfo_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "policyId": "ply_48eeba57-2cd5-4159-a2cb-057a23a35e65"
}'
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'My DeFi Gas Sponsorship',
    strategy: {
      sponsorSchema: 'pay_for_user',
      tokenContract: 'con_48eeba57-2cd5-4159-a2cb-057a23a35e65',
      tokenContractAmount: '1000000000000000000',
      splTokens: ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v']
    },
    paymaster: 'pay_48eeba57-2cd5-4159-a2cb-057a23a35e65',
    chainId: 8453,
    forwarderContractId: 'cfo_48eeba57-2cd5-4159-a2cb-057a23a35e65',
    policyId: 'ply_48eeba57-2cd5-4159-a2cb-057a23a35e65'
  })
})
```

## Get a fee sponsorship

`GET /v2/fee-sponsorship/{feeSponsorshipId}`

Retrieves the details of a fee sponsorship.

### Path parameters

- `feeSponsorshipId` `string` _(required)_: Specifies the unique fee sponsorship ID (starts with pol_).

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `createdAt` `integer <int32>` _(required)_
- `name` `string | null` _(required)_: Name of the fee sponsorship policy.
- `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
- `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
- `enabled` `boolean` _(required)_: Whether the policy is enabled.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
  - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
- `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
- `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
- `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.

#### `401`: Unauthorized.

#### `404`: Not found.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65')
```

## Update a fee sponsorship

`PUT /v2/fee-sponsorship/{feeSponsorshipId}`

Updates a fee sponsorship.

### Path parameters

- `feeSponsorshipId` `string` _(required)_: Specifies the unique fee sponsorship ID (starts with pol_).

### Request body (required) (`application/json`)

- `name` `string`: Name of the fee sponsorship policy.
- `strategy` `object`: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract UUID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `splTokens` `string[]`: SPL mint addresses (base58) accepted as fee payment for Solana charge_custom_tokens policies. Solana-only; mutually exclusive with tokenContract / tokenContractAmount.
- `chainId` `integer <int32>`: Chain ID for single-chain sponsorship.
- `forwarderContractId` `string`: Forwarder contract UUID (optional, for meta-transactions).
- `policyId` `string`: Link to a policy for criteria-based transaction filtering.

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `createdAt` `integer <int32>` _(required)_
- `name` `string | null` _(required)_: Name of the fee sponsorship policy.
- `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
- `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
- `enabled` `boolean` _(required)_: Whether the policy is enabled.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
  - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
- `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
- `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
- `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.

#### `400`: Bad request.

#### `401`: Unauthorized.

#### `404`: Not found.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65 \
  --request PUT \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Updated Gas Sponsorship",
  "strategy": {
    "sponsorSchema": "pay_for_user",
    "tokenContract": "con_48eeba57-2cd5-4159-a2cb-057a23a35e65",
    "tokenContractAmount": "1000000000000000000",
    "splTokens": [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    ]
  },
  "chainId": 8453,
  "forwarderContractId": "cfo_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "policyId": "ply_48eeba57-2cd5-4159-a2cb-057a23a35e65"
}'
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Updated Gas Sponsorship',
    strategy: {
      sponsorSchema: 'pay_for_user',
      tokenContract: 'con_48eeba57-2cd5-4159-a2cb-057a23a35e65',
      tokenContractAmount: '1000000000000000000',
      splTokens: ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v']
    },
    chainId: 8453,
    forwarderContractId: 'cfo_48eeba57-2cd5-4159-a2cb-057a23a35e65',
    policyId: 'ply_48eeba57-2cd5-4159-a2cb-057a23a35e65'
  })
})
```

## Delete a fee sponsorship

`DELETE /v2/fee-sponsorship/{feeSponsorshipId}`

Deletes a fee sponsorship.

This is a soft delete - the fee sponsorship is marked as deleted but not removed from the database.

### Path parameters

- `feeSponsorshipId` `string` _(required)_: Specifies the unique fee sponsorship ID (starts with pol_).

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `deleted` `boolean` _(required)_

#### `401`: Unauthorized.

#### `404`: Not found.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65 \
  --request DELETE
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65', {
  method: 'DELETE'
})
```

## Enable a fee sponsorship

`PUT /v2/fee-sponsorship/{feeSponsorshipId}/enable`

Enables a fee sponsorship.

### Path parameters

- `feeSponsorshipId` `string` _(required)_: Specifies the unique fee sponsorship ID (starts with pol_).

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `createdAt` `integer <int32>` _(required)_
- `name` `string | null` _(required)_: Name of the fee sponsorship policy.
- `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
- `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
- `enabled` `boolean` _(required)_: Whether the policy is enabled.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
  - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
- `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
- `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
- `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.

#### `401`: Unauthorized.

#### `404`: Not found.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65/enable \
  --request PUT
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65/enable', {
  method: 'PUT'
})
```

## Disable a fee sponsorship

`PUT /v2/fee-sponsorship/{feeSponsorshipId}/disable`

Disables a fee sponsorship.

### Path parameters

- `feeSponsorshipId` `string` _(required)_: Specifies the unique fee sponsorship ID (starts with pol_).

### Responses

#### `200`: Successful response.

Body (`application/json`):

- `id` `string` _(required)_
- `object` `string` _(required)_
- `createdAt` `integer <int32>` _(required)_
- `name` `string | null` _(required)_: Name of the fee sponsorship policy.
- `description` `string | null` _(required)_: Description or comment for the fee sponsorship.
- `chainId` `integer | null` _(required)_: Chain ID for single-chain sponsorship.
- `enabled` `boolean` _(required)_: Whether the policy is enabled.
- `strategy` `object` _(required)_: Sponsorship strategy configuration.
  - `sponsorSchema` `string` _(required)_: The sponsorship schema type.
  - `tokenContract` `string`: Token contract ID for charge_custom_tokens or fixed_rate schemas.
  - `tokenContractAmount` `string`: Token amount for charge_custom_tokens or fixed_rate schemas.
  - `dynamicExchangeRate` `boolean`: Whether the exchange rate is computed dynamically from cached prices. True when tokenContractAmount was not provided at creation time.
  - `splTokens` `string[]`: SPL mint addresses accepted for fee payment on Solana charge_custom_tokens policies.
- `paymasterId` `string | null` _(required)_: Paymaster ID (optional).
- `forwarderContractId` `string | null` _(required)_: Forwarder contract ID (optional, for meta-transactions).
- `policyId` `string | null` _(required)_: Linked policy ID for criteria-based transaction filtering.

#### `401`: Unauthorized.

#### `404`: Not found.

### Example request

```bash
curl https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65/disable \
  --request PUT
```

```ts
fetch('https://api.openfort.io/v2/fee-sponsorship/pol_48eeba57-2cd5-4159-a2cb-057a23a35e65/disable', {
  method: 'PUT'
})
```
