Authentication, Rate Limits, and Error Handling
Authentication
See How to Send a Request below for service URLs and important info, as well as our Authentication and API Keys guide for how to create and edit API keys.Rate Limits
When you surpass the QPS limit for a key, we return a JSON-RPC error code-32010
. We recommend implementing retries with a backoff to handle any rate limits errors that arise. If you haven’t assigned all the QPS you have for a network, or one key has more than it needs, you can adjust the rate limits of your keys to better balance your QPS allotment across your keys. You may also be able to reduce requests by using methods like sui_multiGetObjects
instead of multiple calls to sui_getObject
.
Notes:Depending on your plan, you may also be subject to overall daily request limits. Hitting this limit will result result in a
-32012
, and you should not retry until the next day UTC. You can see your Node Service request totals in the Node Service Metrics section of your Shinami Dashboard. You can see your account limits on the “Sui Node Service” tab of the Billing page of your Shinami dashboard, where you can also upgrade your plan if needed.Error Handling
See our Error Reference guide.How to Send a Request
When sending a request to our Node Service:- Use the URL of the region you wish you send your requests to (see table below).
-
Send your access key in one of these two ways (done automatically by our TypeScript SDK):
- A header (recommended for reduced visibility in logs, etc):
"X-Api-Key: YOUR_ACCESS_KEY"
- In the URL: e.g.
https://api.us1.shinami.com/sui/node/v1/ACCESS_KEY
- A header (recommended for reduced visibility in logs, etc):
-
Use an access key from the same region as the URL you’re using. Region URLs -
us1
above - only work with API keys created in the same region. So, to use this API, you’ll make Node Service API keys in ourUS East - us1
region. - Use an access key tied to the region and Sui network you want to interact with. When you create an API access key in your Shinami dashboard, you give it rights to exactly one network. We route to Mainnet or Testnet based on the API access key you send in the request. Note: Testnet is currently not offered in Tokyo, as shown in the table below.
Region name | Location | Networks offered | Service URL (same URL for all networks offered) | Only works with API keys made in |
---|---|---|---|---|
US East - us1 | Eastern United States | Testnet, Mainnet | https://api.us1.shinami.com/sui/node/v1 | US East - us1 |
Tokyo - apac1 | Tokyo, Japan | Mainnet | https://api.apac1.shinami.com/sui/node/v1 | Tokyo - apac1 |
Tokyo - apac1
with our SDK
When using our TypeScript SDK, just construct it with an API key from Tokyo - apac1
and we’ll set the Tokyo - apac1
URL automatically! Since the region is encoded in the API key name (e.g. apac1_sui_mainnet_59...
) we know what URL to set. For those with older API keys from US East - us1
that don’t have the region encoded in the name, the SDK will handle this as well by defaulting to the US East - us1
URL.
Sample Request
Here is a quick sample request you can make using cURL, the Shinami Clients TypeScript SDK, the Mysten Rust SDK, or the Mysten TypeScript SDK. It’s asking for the current reference price for gas on Testnet. We also show how to use Shinami with the Sui CLI for a different operation, in case you use that. Because Testnet is currently only offered in ourUS East - us1
region, the sample code uses the service URL associated with that region: https://api.us1.shinami.com/sui/node/v1/
. To send to Mainnet in our Tokyo - apac1
region, you would use an API key from that region and send to https://api.apac1.shinami.com/sui/node/v1/
. This is set by our SDK automatically when you use an APAC API key (since the region is encoded in the api key name, we know what URL to set).
Example Request Template
The TypeScript example uses the Shinami Clients SDK, which you can install with:
Shell
{{name}}
with the actual value for that name