Docs Navigationexpand_more

Dev Platform

Dev Platform: Authentication & Requests

Create API credentials, generate bearer tokens with M2M auth, and execute contract methods securely.

API Keys

Once you have funded a wallet and configured a contract method, create an onchain transaction by making a POST request to the 1Shot API. First, generate a bearer token from your API key and secret.

Create an API key and secret from the API Keys tab in the 1Shot API console. Click Create New Key and give it a name. Keys are active immediately and can be used to generate bearer tokens right away. If a key is deleted, it is immediately and permanently deactivated.

Generating a Bearer Token

1Shot API uses the machine-to-machine (M2M) flow for authentication. Generate a bearer token with a POST request to https://api.1shotapi.com/v0/token.

curl -X POST https://api.1shotapi.com/v0/token \
    -H "Content-Type: application/json" \
    -d '{"grant_type": "client_credentials", "client_id":"{YOUR_API_CLIENT_ID}", "client_secret": "{YOUR_API_CLIENT_SECRET}"}'

A successful request returns status 200 with a JSON payload containing your access token:

{
    "access_token": "string",
    "token_type": "Bearer",
    "expires_in": 0,
    "scope": "string"
}

You can inspect your access token in JWT.io. Bearer tokens expire after 1 hour, so generate a new token when needed.

Triggering a Transaction

Trigger a transaction with POST https://api.1shotapi.com/v0/methods/{CONTRACT_METHOD_ID}/execute and your bearer token:

# Transfer 1 ERC-20 token to address 0xE936e8FAf4A5655469182A49a505055B71C17604
curl -X POST https://api.1shotapi.com/v0/methods/{CONTRACT_METHOD_ID}/execute \
    -H "Authorization: Bearer YOUR_BEARER_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"params": {"to": "0xE936e8FAf4A5655469182A49a505055B71C17604", "value": "1000000000000000000"}}' | jq .

The object under params must match the input data your contract method endpoint is configured to accept.

List Available Contract Methods

Get a JSON list of all transactions currently configured for your organization:

curl -X GET https://api.1shotapi.com/v0/business/{BUSINESS_ID}/methods \
    -H "Authorization: Bearer YOUR_BEARER_TOKEN" | jq .

See the OpenAPI specification for a complete reference of all 1Shot API endpoints.

Client SDK

You can use the official 1Shot API TypeScript SDK instead of raw HTTP requests. For agentic coding workflows, use it in combination with the 1Shot API skill and MCP server.