Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/lib/sidebar-icons.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { ReactNode } from 'react'
import { IconExchange, IconServer, IconTopologyBus, IconWorld } from '@tabler/icons-react'
import { IconExchange, IconKey, IconServer, IconTopologyBus, IconWorld } from '@tabler/icons-react'
import { GodotIcon, UnityIcon } from '@/components/brand-icons'

const icons: Record<string, ReactNode> = {
godot: <GodotIcon />,
unity: <UnityIcon />,
http: <IconWorld />,
admin: <IconKey />,
sockets: <IconTopologyBus />,
selfhosting: <IconServer />,
integrations: <IconExchange />,
Expand Down
24 changes: 24 additions & 0 deletions content/docs/admin/authentication.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Learn how to authenticate your Admin API requests.
title: Authentication
---

## What is the Admin API?

The Admin API is a way of programmatically managing your game data like stats and leaderboards.

Unlike the gameplay-orientated [HTTP API](/docs/http/authentication), which authenticates requests on behalf of players, the Admin API authenticates requests using admin API keys scoped to your game.

## Creating an admin API key

You can create admin API keys on the [API keys page](https://dashboard.trytalo.com/api-keys) inside the Talo dashboard. When creating a key, you choose which scopes it has. Each endpoint lists the scopes it requires (for example `read:stats` or `write:stats`).

## Making a request

Admin API requests are authenticated with an admin API key sent in the `Authorization` header:

```
Authorization: Bearer ta_.....
```

All Admin API endpoints are served under the `/admin/v1` prefix.
78 changes: 78 additions & 0 deletions content/docs/admin/game-stat-api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
description: Manage game stats via the admin API. Create stats, find them and view their metrics.
title: Game stat admin API
---

import { ServiceDocumentation } from '@/components/documentation/ServiceDocumentation'
import { generateServiceTOC } from '@/lib/api-docs'

export const service = 'GameStatAdminAPI'

export const pageToc = [
{ title: 'Overview', url: '#overview', depth: 2 },
{ title: 'Endpoints', url: '#endpoints', depth: 2 },
...generateServiceTOC(service),
{ title: 'Types', url: '#types', depth: 2 },
{ title: 'Stat', url: '#stat', depth: 3 },
{ title: 'StatMetrics', url: '#statmetrics', depth: 3 },
]

## Overview

The game stat admin API lets you create, update, delete and reset [game stats](/docs/http/game-stat-api) programmatically, as well as read stats and their metrics. This is useful for automation like creating stats ahead of a new patch or resetting player stats between competitive seasons.

## Endpoints

<ServiceDocumentation
service={service}
metaDescription="Talo's game stat admin API lets you manage game stats and their metrics server-side using admin API keys."
/>

## Types

### Stat

```ts
type Stat = {
id: number
internalName: string
name: string
global: boolean
globalValue: number
metrics?: StatMetrics // see below
defaultValue: number
maxChange: number | null
minValue: number | null
maxValue: number | null
minTimeBetweenUpdates: number
createdAt: string
updatedAt: string
}
```

### StatMetrics

Metrics are **optional** and only included when the `withMetrics` query parameter is set on [list](/docs/admin/game-stat-api#get-all-game-stats) and [find](/docs/admin/game-stat-api#get-an-individual-game-stat) requests. When `withMetrics` is set, the `metrics` property is included with the stat response.

```ts
type StatMetrics = {
globalCount: number
globalValue: GlobalValueMetrics
playerValue: PlayerValueMetrics
}

type GlobalValueMetrics = {
minValue: number
maxValue: number
medianValue: number
averageValue: number
averageChange: number
}

type PlayerValueMetrics = {
minValue: number
maxValue: number
medianValue: number
averageValue: number
}
```
5 changes: 5 additions & 0 deletions content/docs/admin/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"pages": ["authentication", "game-stat-api"],
"title": "Admin API reference",
"icon": "admin"
}
1 change: 1 addition & 0 deletions content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ title: Talo overview
<Card title='Godot' description='Add the Talo Godot plugin to your game' href='/docs/godot/install' />
<Card title='Unity' description='Add the Talo Unity package to your game' href='/docs/unity/install' />
<Card title='HTTP API' description="Use Talo over REST" href='/docs/http/authentication' />
<Card title='Admin API' description='Manage your Talo data server-side' href='/docs/admin/authentication' />
<Card title='Socket reference' description='Create multiplayer interactions using websockets' href='/docs/sockets/intro' />
<Card title='Self-hosting' description='Run Talo using your own infrastructure' href='/docs/selfhosting/overview' />
<Card title='Integrations' description='Sync data between Talo and external services' href='/docs/integrations/steamworks' />
Expand Down
2 changes: 1 addition & 1 deletion content/docs/meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"pages": ["index", "godot", "unity", "http", "sockets", "selfhosting", "integrations"]
"pages": ["index", "godot", "unity", "http", "admin", "sockets", "selfhosting", "integrations"]
}
Loading