Skip to content
Launch App >

Authentication endpoints for the Turbine.cash API.

NetworkURL
Mainnethttps://worker.turbine.cash
Devnethttps://api-devnet.turbine.cash

Authenticate with a wallet signature.

POST /login
Content-Type: application/json
{
"wallet": "YourWalletPublicKeyBase58",
"signature": "SignatureBase58",
"message": 1705432800
}
FieldTypeDescription
walletstringWallet public key (base58)
signaturestringSignature of the message (base58)
messagenumberUnix timestamp that was signed
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
FieldTypeDescription
idstring (UUID)Auth token for subsequent requests
const timestamp = Math.floor(Date.now() / 1000);
const messageBytes = new TextEncoder().encode(timestamp.toString());
const signatureBytes = await wallet.signMessage(messageBytes);
const response = await fetch('https://worker.turbine.cash/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
wallet: wallet.publicKey.toBase58(),
signature: bs58.encode(signatureBytes),
message: timestamp,
}),
});
const { id: authToken } = await response.json();
StatusErrorCause
400Invalid signatureSignature doesn’t match wallet/message
400Message too oldTimestamp is stale
500Server errorInternal error

Check if an auth token is valid.

GET /is_logged/{id}
ParameterTypeDescription
idstringAuth token to check

Valid token:

200 OK
"true"

Invalid token:

200 OK
"false"
async function isTokenValid(authToken: string): Promise<boolean> {
const response = await fetch(
`https://worker.turbine.cash/is_logged/${authToken}`
);
const result = await response.text();
return result === 'true';
}

Include the auth token in the x-api-auth header for authenticated endpoints:

const response = await fetch('https://worker.turbine.cash/some-endpoint', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-auth': authToken,
},
body: JSON.stringify(requestBody),
});