OCHE // API GUIDE
← DOCUMENTATION HOME
API Overview
Public API for Integrations
Oche Developer Guide

Introduction

The Oche API is a RESTful JSON API that powers the mobile app and can be used for third-party integrations. All responses are in JSON format.

DetailValue
Base URLhttps://oche.tekninja.uk/api
FormatJSON
AuthBearer token (Laravel Sanctum)

Authentication

Most API endpoints require authentication. Oche uses Laravel Sanctum bearer tokens.

Register

POST /api/auth/register

{
  "name": "John Smith",
  "email": "john@example.com",
  "password": "your-password",
  "password_confirmation": "your-password"
}

Login

POST /api/auth/login

{
  "email": "john@example.com",
  "password": "your-password"
}

Response:
{
  "token": "1|abc123...",
  "user": { "id": 1, "name": "John Smith", ... }
}

Using the Token

Include the token in the Authorization header for all authenticated requests:

Authorization: Bearer 1|abc123...

Device Authentication

For guest mode (no account), devices authenticate via a unique device ID:

POST /api/auth/device

{
  "device_id": "unique-device-uuid"
}

Endpoints Overview

Health Check

MethodEndpointAuthDescription
GET/api/pingNoServer health check

Players

MethodEndpointDescription
GET/api/playersList all players
POST/api/playersCreate a player
GET/api/players/{id}Get player details
PUT/api/players/{id}Update a player
DELETE/api/players/{id}Delete a player
GET/api/players/{id}/statsGet player statistics

Games

MethodEndpointDescription
GET/api/gamesList games (paginated)
POST/api/gamesCreate a new game
GET/api/games/{uuid}Get game details
POST/api/games/{uuid}/turnsAdd a turn/score
DELETE/api/games/{uuid}/turns/lastUndo last turn
POST/api/games/syncSync offline games

Venues

MethodEndpointDescription
GET/api/venuesList venues
POST/api/venuesCreate a venue
GET/api/venues/{id}Get venue details
GET/api/venues/{id}/statsVenue statistics
POST/api/venues/{id}/checkinCheck in to venue
POST/api/venues/{id}/checkoutCheck out of venue

Tournaments

MethodEndpointDescription
GET/api/tournamentsList tournaments
POST/api/tournamentsCreate a tournament
GET/api/tournaments/{id}Get tournament details
POST/api/tournaments/{id}/startStart the tournament
POST/api/tournaments/fixtures/{id}/resultSubmit fixture result
GET/api/tournaments/{id}/statsTournament statistics

Error Responses

The API uses standard HTTP status codes:

CodeMeaning
200Success
201Created
401Unauthenticated — invalid or missing token
403Forbidden — insufficient permissions
404Not found
422Validation error — check the errors field
500Server error

Validation Error Format

{
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."],
    "password": ["The password must be at least 8 characters."]
  }
}

Rate Limiting

The API enforces rate limiting to prevent abuse. Current limits:

Rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58

See Also