Skip to main content
This guide will help you make your first API calls to G2C Platform and create your first wallet and tokens in just a few minutes.

Prerequisites

Before you start, youโ€™ll need:
  • A G2C Platform account
  • Your API key (X-API-Key)
  • A tool for making HTTP requests (curl, Postman, or your favorite HTTP client)

Step 1: Get Your API Key

Log in to the Dashboard and create a new API Key from the Administration > API Keys section. If you need assistance, contact us at [email protected].
Keep your API key secure and never expose it in client-side code or public repositories.

Step 2: Test the API Connection

Letโ€™s start with a simple health check to verify the API is working:
curl -X GET "https://api.g2cplatform.com/v2/health"
You should receive a response indicating the API server is healthy:
{
  "status": "healthy",
  "timestamp": "2024-03-15T10:30:00Z",
  "version": "2.0.0",
  "uptime": 86400,
  "checks": {
    "database": "healthy",
    "blockchain": "healthy",
    "storage": "healthy"
  }
}

Step 3: Create Your First Wallet

Wallets are digital identities that can hold and transfer tokens. Letโ€™s create one:
curl -X POST "https://api.g2cplatform.com/v2/wallets" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "myuser123",
    "password": "SecurePassword123!",
    "email": "[email protected]"
  }'
Response:
{
  "id": "wallet_123e4567-e89b-12d3-a456-426614174000",
  "username": "myuser123",
  "email": "[email protected]",
  "status": "active",
  "blockchainAddress": "0x1234567890abcdef...",
  "createdAt": "2024-03-15T10:30:00Z",
  "updatedAt": "2024-03-15T10:30:00Z"
}
Save the wallet ID - youโ€™ll need it for token operations!

Step 4: Authenticate Your Wallet

To perform wallet operations, you need to authenticate and get a JWT token:
curl -X POST "https://api.g2cplatform.com/v2/auth/wallet/login" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "myuser123@your-app-id",
    "password": "SecurePassword123!"
  }'

Step 5: Mint Your First Token

Now letโ€™s create your first blockchain token! You can mint either fungible tokens or NFTs:

Mint a Fungible Token (Digital Currency)

curl -X POST "https://api.g2cplatform.com/v2/tokens/mint" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "fungible",
    "symbol": "MYCOIN",
    "amount": 1000,
    "receiverWalletId": "wallet_123e4567-e89b-12d3-a456-426614174000"
  }'

Mint an NFT (Unique Certificate)

curl -X POST "https://api.g2cplatform.com/v2/tokens/mint" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "nft",
    "receiverWalletId": "wallet_123e4567-e89b-12d3-a456-426614174000",
    "nftMetadata": {
      "name": "My First NFT Certificate",
      "description": "A unique digital certificate",
      "image": "https://example.com/certificate.png",
      "attributes": [
        {
          "trait_type": "Certificate Type",
          "value": "Completion"
        },
        {
          "trait_type": "Issue Date",
          "value": "2024-03-15"
        }
      ]
    }
  }'

Step 6: View Your Tokens

Check the tokens in your wallet:
curl -X GET "https://api.g2cplatform.com/v2/tokens?walletId=wallet_123e4567-e89b-12d3-a456-426614174000" \
  -H "X-API-Key: your-api-key"

๐ŸŽ‰ Congratulations!

Youโ€™ve successfully:
  • โœ… Connected to the G2C Platform API
  • โœ… Created your first wallet
  • โœ… Authenticated with JWT tokens
  • โœ… Minted your first blockchain tokens
  • โœ… Viewed your token holdings

Next Steps

Troubleshooting

Common Issues

Authentication Error (401)
  • Verify your API key is correct
  • Check that youโ€™re using the right authentication header
Wallet Creation Failed
  • Ensure username is unique
  • Password must meet security requirements (min 8 chars)
Token Minting Failed
  • Verify the wallet ID exists
  • Check that you have sufficient permissions

Need Help?