Overview

The Membership API allows users to connect their wallets (EVM, Solana, or TON) and become members of Turtle. This API follows a secure three-step flow to ensure wallet ownership verification.

Authentication Flow

1

Check Membership Status

Verify if a wallet address is already associated with a Turtle account
2

Request Signature Agreement

Generate a message that must be signed by the wallet to prove ownership
3

Create Membership

Submit the signed message to create a new user account and associate the wallet

Endpoints

Check Membership Status

curl -X GET "https://api.turtle.xyz/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
Query Parameters
address
string
required
The wallet address to check
walletEcosystem
string
default:"evm"
The blockchain ecosystem. Supported values: evm, solana, ton
Response
{
  "isMember": false
}

Request Signature Agreement

curl -X POST https://api.turtle.xyz/membership/agreement \
  -H "Content-Type: application/json" \
  -d '{
    "address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
    "walletEcosystem": "evm",
    "url": "https://turtle.xyz",
    "chainId": "1"
  }'
Request Body
address
string
required
The wallet address requesting membership
walletEcosystem
string
required
The blockchain ecosystem. Supported values: evm, solana, ton
url
string
required
The URL of the application (used in the signature message)
chainId
string
default:"1"
The chain ID for EVM wallets. Not required for Solana or TON
Response
{
  "nonce": "550e8400-e29b-41d4-a716-446655440000",
  "message": "turtle.xyz wants you to sign in with your Ethereum account:\n0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D\n\nSign Up to Turtle\n\nURI: https://turtle.xyz\nVersion: 1\nChain ID: 1\nNonce: 550e8400-e29b-41d4-a716-446655440000\nIssued At: 2024-01-15T10:00:00Z"
}

Create Membership

curl -X POST https://api.turtle.xyz/membership \
  -H "Content-Type: application/json" \
  -d '{
    "address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
    "walletEcosystem": "evm",
    "signature": "0x1234567890abcdef...",
    "nonce": "550e8400-e29b-41d4-a716-446655440000"
  }'
Request Body
address
string
required
The wallet address creating the membership
walletEcosystem
string
required
The blockchain ecosystem. Supported values: evm, solana, ton
signature
string
required
The signature of the message returned by the agreement endpoint
nonce
string
required
The nonce returned by the agreement endpoint
Response
{
  "isMember": true,
  "error": ""
}

Complete Flow Example

Here’s a complete example of the membership creation flow:
# Step 1: Check if wallet is already a member
curl -X GET "https://api.turtle.xyz/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
# Response: {"isMember": false}

# Step 2: Request signature agreement
curl -X POST https://api.turtle.xyz/membership/agreement \
  -H "Content-Type: application/json" \
  -d '{
    "address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
    "walletEcosystem": "evm",
    "url": "https://turtle.xyz",
    "chainId": "1"
  }'
# Response: {"nonce": "550e8400...", "message": "turtle.xyz wants you to sign..."}

# Step 3: Sign the message with your wallet (using web3 library or wallet app)
# This step happens client-side

# Step 4: Submit the signature to create membership
curl -X POST https://api.turtle.xyz/membership \
  -H "Content-Type: application/json" \
  -d '{
    "address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
    "walletEcosystem": "evm",
    "signature": "0x1234567890abcdef...",
    "nonce": "550e8400-e29b-41d4-a716-446655440000"
  }'
# Response: {"isMember": true, "error": ""}

# Step 5: Verify membership was created
curl -X GET "https://api.turtle.xyz/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
# Response: {"isMember": true}

Error Handling

Common Errors

Security Considerations

Never share your private keys or seed phrases. The API only requires signatures, not private keys.
  • Nonces are single-use and expire after a short period
  • Messages follow the EIP-4361 standard for EVM wallets
  • All signatures are verified server-side before creating accounts