Increase user engagement and retention by sponsoring transactions


Use Cases

Shinami's Gas Station API lets you easily sponsor transactions for your users. APT is pulled from a fund you create to power these transactions, managed in Shinami's dashboard.

Shinami facilitates sponsored transactions based on logic determined by you, the app developer. Examples include sponsoring each user's initial transaction(s) for better onboarding and sponsoring transactions of a particular type that you want to encourage.

Authentication, Rate Limits, and Error Handling


You authenticate via an access key passed in a header ('X-Api-Key: ACCESS_KEY') or in the request url, e.g. We recommend using a request header and not putting access keys in your request URLs for reduced visibility (in logs, etc).

For more information, including how to set up API access keys, see our Authentication and API Keys guide.


Call Shinami's Gas Station from your backend server

Shinami Gas Station does not support CORS requests, so you will get a CORS error if you make requests from your frontend. Use your backend server to integrate with Shinami's Gas Station. This limits exposure of your sponsorship access keys. If these keys are leaked, bad actors have the ability to sponsor transactions from your fund until it has been drained or you disable the key in our dashboard.

Rate Limits

Gas Station access keys have a rate limit of 10 QPS. When you surpass this, we return a JSON-RPC error code -32010. We recommend implementing retries with a backoff to handle any rate limits errors that arise. You can also consider batching multiple Move calls into a Move script.

Error Handling

See our Error Reference for guidance on the errors you may receive from our services, including a section on errors specific to the Aptos Gas Station API.

Create and sponsor a transaction

This section shows an example of how to build and sponsor a simple transaction using the Shinami Clients SDK and the Aptos TS SDK. For a high-level image of the sponsorship flow see here. For full sample code showing how to build, sponsor, and submit a transaction, see our Gas Station TypeScript Tutorial


  1. Build your transaction with the fee payer address set to 0x0 (this is what happens when you set withFeePayer: true as shown below).
  2. The transaction's expiration timestamp must be set to a time within the next hour (as is required by our Gas Station). When you control the generation of the sender's signature, as with an embedded wallet you control for the user, you can likely use the SDK default, which is 20 seconds from now. When you need to wait on a signature you don't control, as with a connected wallet where the user must approve a signing message, you can explicitly set it as in the example below.

Replace all instances of {{name}} with the actual value for that name

import { GasStationClient } from "@shinami/clients/aptos";
import { Account, Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

// Create an Aptos client and generate an account to act as the sender
const aptos = new Aptos(new AptosConfig({ network: Network.TESTNET }));
const account = Account.generate({});

// Create a Shinami Gas Station client for sponsoring our transactions.
const gasStationClient = new GasStationClient(SHINAMI_TESTNET_GAS_KEY);

// This transaction makes a function call to a module we've deployed on Testnet
const FIVE_MINUTES_FROM_NOW_IN_SECONDS = Math.floor( / 1000) + (5 * 60);
const transaction = await{
    sender: account.accountAddress,
    withFeePayer: true,
    data: {
      function: "0xc13c3641ba3fc36e6a62f56e5a4b8a1f651dc5d9dc280bd349d5e4d0266d0817::message::set_message",
      functionArguments: ["test message"]
    options: {
        expireTimestamp: FIVE_MINUTES_FROM_NOW_IN_SECONDS

// Send `transaction` to Shinami for sponsorship
let feePayerAuthenticator = await gasStationClient.sponsorTransaction(transaction);

// Note that our SDK updates the transaction's feePayer address on a successful sponsorship
console.log("transaction.feePayerAddress post-sponsorship:", transaction.feePayerAddress);

// Generate the sender's signature (senderAuthenticator below)
//  When you submit the transaction, just plug in the response from Gas Station
//   as the `feePayerAuthenticator` argument
const committedTransaction = await aptos.transaction.submit.simple({
    feePayerAuthenticator: feePayerAuthenticator,



Sponsor a transaction by having your Shinami Gas Station fund act as the feePayer.

Shinami sponsorship fees: We charge a small fee (in APT) per sponsorship request to cover our costs. For details, visit your Shinami dashboard's Billing tab .

Request Parameters

transactionTypeScript SDK:

String | byte array
TypeScript SDK:
An AnyRawTransaction (the result of a successful call to or

BCS-serialized RawTransaction component of an AnyRawTransaction. Can be passed either as an unsigned byte array or a hex string.

Note: the transaction's expiration timestamp must be set to a time within the next hour, in seconds. Otherwise, our service will not sponsor the transaction.
[String]Optional array of additional signer addresses. Must be in the exact order. Required for multi-agent transactions.

Example Request Template

The TypeScript example uses the Shinami Clients SDK.

Replace all instances of {{name}} with the actual value for that name

import { GasStationClient } from "@shinami/clients/aptos";

const gas = new GasStationClient("{{gasStationAccessKey}}");

await gas.sponsorTransaction(transaction);
 curl \
-H 'X-API-Key: {{gasStationAccessKey}}' \
-H 'Content-Type: application/json' \
-d '{ 

Example Response

  public_key: { key: { data: [Object] } },
  signature: { data: { data: [Object] } }

TypeScript SDK Response Fields

Note transaction.feePayerAddress is updated in-place upon a successful return.

AccountAuthenticatorAccountAuthenticator of the sponsor, to be included in the request to submit the transaction to the chain.

cURL Response Fields

feePayer.addressStringFee payer account address. If desired you can use this to set the transaction's feePayerAddress before obtaining sender and any secondary signer signatures.
feePayer.signatureUnsigned byte arrayBCS-serialized AccountAuthenticator of the fee payer, as an array of unsigned bytes.