curl -X POST "https://gachabe-staging.fly.dev/api/v1/players/guest/create" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "player",
      "attributes": {},
      "relationships": {}
    }
  }'
{
  "data": {
    "type": "player",
    "id": "guest_550e8400-e29b-41d4-a716-446655440000",
    "attributes": {
      "email": null,
      "is_anonymous": true
    },
    "relationships": {
      "chests": {
        "data": []
      }
    }
  },
  "included": [],
  "meta": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refresh_token": "refresh_token_string_here",
    "token_type": "Bearer",
    "expires_in": 3600,
    "created_at": "2024-01-15T15:00:00Z",
    "player_type": "guest",
    "initial_currency": {
      "coins": 1000,
      "gems": 50
    }
  }
}
Create a new guest player account for anonymous gameplay. Guest players can collect items and participate in the game without providing personal information.
Guest players can later be converted to registered accounts while preserving their progress and collectibles.

Query Parameters

include
string
Include related data in the response.Available includes: chests
fields
object
Limit response fields to only those specified.

Request Body

data
object
required
Player creation data
curl -X POST "https://gachabe-staging.fly.dev/api/v1/players/guest/create" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "player",
      "attributes": {},
      "relationships": {}
    }
  }'
{
  "data": {
    "type": "player",
    "id": "guest_550e8400-e29b-41d4-a716-446655440000",
    "attributes": {
      "email": null,
      "is_anonymous": true
    },
    "relationships": {
      "chests": {
        "data": []
      }
    }
  },
  "included": [],
  "meta": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refresh_token": "refresh_token_string_here",
    "token_type": "Bearer",
    "expires_in": 3600,
    "created_at": "2024-01-15T15:00:00Z",
    "player_type": "guest",
    "initial_currency": {
      "coins": 1000,
      "gems": 50
    }
  }
}

Response Fields

data
object
required
The created guest player resource
meta
object
required
Authentication and setup information

Guest Player Flow

1

Create guest account

Call this endpoint to create a new anonymous player account.
No authentication required for this step.
2

Store authentication tokens

Save the returned access_token and refresh_token securely.
Without these tokens, the guest player cannot be accessed again.
3

Start playing

Use the access token to authenticate future API requests for this guest player.
Guest players have the same gameplay capabilities as registered players.
4

Optional: Convert to registered player

Guest players can later provide email/password to create a permanent account.
All progress and collectibles are preserved during conversion.

Authentication Setup

// Store tokens securely
localStorage.setItem('access_token', response.meta.access_token);
localStorage.setItem('refresh_token', response.meta.refresh_token);
localStorage.setItem('player_id', response.data.id);

// Use in subsequent requests
const apiCall = async (endpoint) => {
  const token = localStorage.getItem('access_token');
  return fetch(endpoint, {
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/vnd.api+json'
    }
  });
};

Security Considerations

Guest player tokens should be treated as sensitive data. If lost, the guest player cannot be recovered.
Guest players are automatically assigned starter currency and can immediately begin purchasing and opening chests.
Consider implementing a “Save Your Progress” flow that encourages guest players to register before their session ends.