<!-- tempo-docs-context -->
> Source: [/docs/api/fee-payer](https://tempo.xyz/developers/docs/api/fee-payer.md)
> Section: [API reference](https://tempo.xyz/developers/docs/api.md). Tempo API reference: authentication, conventions, endpoints grouped by product, Console management endpoints, JSON-RPC, and the indexer. An API key authenticates API requests; an account signing key authorizes transactions.
> [Documentation index](https://tempo.xyz/developers/llms.txt) · [Docs skill](https://tempo.xyz/developers/SKILL.md)

> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.xyz/developers/llms.txt) and Markdown pages directly.

<span id="fee-payer-api" />

# Tempo Fee Payer API

Use the Fee Payer API to cover transaction fees for your users. To run the relay on your own backend with your own sponsorship policy, use the [relay and fee payer handler](https://tempo.xyz/developers/docs/server/relay-handler). For the end-to-end flow, see [Sponsor fees](https://tempo.xyz/developers/docs/guide/payments/sponsor-user-fees).

<span id="how-hosted-fee-sponsorship-works" />

## How the Fee Payer API works

A fee payer pays the fee for a transaction sent by another account. Use one to cover transaction costs for your users.

The sender authorizes the transaction, and the fee payer separately authorizes the fee. When you prepare a transaction, request sponsorship from a fee payer endpoint. The service applies its policy, fills the required fields, and reports whether the request was sponsored.

Tempo supports this flow natively, so you do not need a paymaster contract, bundler, or EntryPoint contract.

<span id="hosted-fee-payer-endpoints" />

## Hosted fee payer endpoint

The Tempo API provides a hosted JSON-RPC relay that fills, sponsors, and broadcasts Tempo Transactions. Authenticate with a [Tempo API key](https://tempo.xyz/developers/docs/api/authentication), then use the Fee Payer API as your sponsorship RPC URL:

```text
https://api.tempo.xyz/rpc/sponsor
```

<span id="configure-clients-for-hosted-fee-sponsorship" />

<span id="get-started" />

## Set up fee sponsorship

::::steps
### Sign into the Tempo Console

Open the [Tempo Console](https://console.tempo.xyz/?to=/\:org/projects) and select **Sign in with Tempo**.

:::info
Tempo Console signups are currently limited. [Contact us](https://tempo.xyz/contact/) to request access.
:::

<span id="set-up-organization" />

### Create an organization

Create an organization and project.

### Set up billing

For this testnet example, switch to [**Sandbox mode**](https://console.tempo.xyz/?to=/\:org/projects%3Fenv%3Dsandbox) (located in the top-left organization picker), then open [**Billing**](https://console.tempo.xyz/?to=/\:org/billing%3Fenv%3Dsandbox) and add a payment method.

<span id="get-an-api-key" />

### Create an API key

Open [**API Keys**](https://console.tempo.xyz/?to=/\:org/api-keys%3Fenv%3Dsandbox), select [**New key**](https://console.tempo.xyz/?to=/\:org/api-keys/new%3Fenv%3Dsandbox), choose your project, and create the key. Copy it when prompted; it is shown only once.

### Sponsor transaction fees

Configure Viem's [`withRelay`](https://viem.sh/tempo/transports/withRelay) transport with a default RPC transport and the Tempo API sponsorship endpoint. Add your Tempo API key through the endpoint's `key` search parameter, then set `feePayer: true` when sending a transaction to request sponsorship.

:::info
The transaction’s chain ID selects the network; `testnet: true` sets Moderato in this example. For mainnet, remove that flag, use a production key (`tempo:sk:...`), and activate production billing. Sandbox keys cannot sponsor mainnet transactions.
:::

```ts twoslash [example.ts]
import { Account, createClient, http, withRelay } from 'viem/tempo'

const client = createClient({
  account: Account.fromSecp256k1('0x...'),
  testnet: true,
  transport: withRelay( // [!code focus]
    http(), // default transport // [!code focus]
    http('https://api.tempo.xyz/rpc/sponsor?key=tempo_sandbox:sk:...'), // relay transport // [!code focus]
  ), // [!code focus]
})

const receipt = await client.sendTransactionSync({
  data: '0xdeadbeef',
  feePayer: true, // [!code focus]
  to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
::::

## Public testnet fee payer

For demos and testnet development without an API key, use Tempo's public fee payer endpoint:

```text
https://sponsor.moderato.tempo.xyz
```

Use the Fee Payer API above for authenticated sandbox and production integrations.

<span id="use-a-fee-payer-in-production" />

<span id="learn-more" />

## Fee sponsorship guides

[Viem Fee Sponsorship](https://viem.sh/tempo/guides/sponsor-fees): Use a local account or fee payer endpoint to sponsor transaction fees with Viem.

[Tempo API Authentication](https://tempo.xyz/developers/docs/api/authentication): Authenticate fee payer requests with a production or sandbox API key.

[Sponsor User Fees](https://tempo.xyz/developers/docs/guide/payments/sponsor-user-fees): Learn how Tempo fee sponsorship works across supported SDKs.

[Tempo Transaction Spec](https://tempo.xyz/developers/docs/protocol/transactions/spec-tempo-transaction#fee-payer-signature-details): Read the fee payer signature details in the Tempo Transaction specification.
