# Game Control

### 1. Get metadata of a specific game

retrieve the game basic information for preview

`POST` <https://api.rpggo.ai/v2/open/game/gamemetadata>&#x20;

**Request Body**

| Name     | Type   | Description               |
| -------- | ------ | ------------------------- |
| game\_id | String | the unique id of the game |

{% code title="Sample Curl" lineNumbers="true" %}

```bash
curl --location 'https://api.rpggo.ai/v2/open/game/gamemetadata' \
--header 'accept: application/json' \
--header 'Authorization:$YOUR_RPGGO_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a"
}'
```

{% endcode %}

{% tabs %}
{% tab title="200: OK " %}
{% code lineNumbers="true" %}

```json
{
    "code": 0,
    "msg": "ok",
    "data": {
        "name": "📒 BAC -Break the boundaries",
        "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
        "background": "",
        "intro": "In 2102, Terminus City has clear class divides, with Mega Corporation ruling. Rebels in the Wild Hope District challenge this after a drone crash.",
        "image": "https://storage.googleapis.com/rpggo-game/rpggo-creator/5c642a81-e09a-4349-b3a2-f00156479dff/9cc4b0a4-6bfa-489a-aee8-57217a2c5cfd",
        "genre": "published",
        "user_id": "",
        "moderation_level": "",
        "background_musics": null,
        "chapters": [
            {
                "name": "The Crash",
                "chapter_id": "da08c8ff-490e-4a7f-853c-c64d8c803b15",
                "background": "Prologue - Marco (you,Player), an underground street racer from the Wild Hope District, is born with a restless nature flowing in his blood, and his sister Chiara seems equally rebellious under his influence.\n\nChiara connected her consciousness to a drone and infiltrated Terminus, but unfortunately, the drone crashed midway. The accident caused severe neurological trauma to Chiara, and angry Marco swore to find the culprit.\n\nhint:\n(Ask each character who they are)\n(Ask each character what happened before and after the accident)\n(Ask each character if they helped Chiara)\n(Ask each character the cause of the accident)",
                "intro": "None",
                "image": "",
                "background_audio": "",
                "ending_audio": ""
            }
        ],
        "interaction": null,
        "created_at": "2024-03-13T04:53:43Z",
        "updated_at": "2024-04-25T04:41:56Z"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

### 2. Start the game

start the game at specific chapter. If chapter\_id is not specified, then start from chapter 1.

`POST` <https://api.rpggo.ai/v2/open/game/startgame>

**Request Body**

| Name        | Type   | Description                                                                                               |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------- |
| game\_id    | String | the unique id of the game                                                                                 |
| chapter\_id | String | the unique id of the start chapter                                                                        |
| session\_id | String | the unique id to identify the play session. The API Caller need to maintian the session\_id in its logic. |

{% code title="Sample Curl" lineNumbers="true" %}

```bash
curl --location 'https://api.rpggo.ai/v2/open/game/startgame' \
--header 'accept: application/json' \
--header 'Authorization:$YOUR_RPGGO_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
  "session_id": "42d029a8sdrrwqd"
}'
```

{% endcode %}

{% tabs %}
{% tab title="200: OK " %}
{% code lineNumbers="true" %}

```json
{
    "code": 0,
    "msg": "ok",
    "data": {
        "name": "📒 BAC -Break the boundaries",
        "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
        "background": "",
        "intro": "In 2102, Terminus City has clear class divides, with Mega Corporation ruling. Rebels in the Wild Hope District challenge this after a drone crash.",
        "image": "https://storage.googleapis.com/rpggo-game/rpggo-creator/5c642a81-e09a-4349-b3a2-f00156479dff/9cc4b0a4-6bfa-489a-aee8-57217a2c5cfd",
        "genre": "published",
        "user_id": "ed10dbe4-7b90-46b8-9d8c-49acbca791ee",
        "chapter": {
            "name": "The Crash",
            "chapter_id": "da08c8ff-490e-4a7f-853c-c64d8c803b15",
            "background": "Prologue - Marco (you,Player), an underground street racer from the Wild Hope District, is born with a restless nature flowing in his blood, and his sister Chiara seems equally rebellious under his influence.\n\nChiara connected her consciousness to a drone and infiltrated Terminus, but unfortunately, the drone crashed midway. The accident caused severe neurological trauma to Chiara, and angry Marco swore to find the culprit.\n\nhint:\n(Ask each character who they are)\n(Ask each character what happened before and after the accident)\n(Ask each character if they helped Chiara)\n(Ask each character the cause of the accident)",
            "intro": "None",
            "image": "",
            "background_audio": "",
            "ending_audio": "",
            "characters": [
                {
                    "id": "7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e",
                    "name": "Chiara",
                    "type": "dm",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/24fd170e-5116-41c8-8d93-57b148d50e42/6bb48ef3-9da7-4e6b-88a6-cc297a0e2987",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "ea1858ce-5317-4689-b940-742dbe0919c8",
                    "name": "Luca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/c47caf17-2a05-44c5-a494-47683b40aef3/f38a1fea-d364-4ee0-b7d7-fb45d9c42593",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec",
                    "name": "Alessio",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f73cd10c-23a0-4dc2-88ad-9663d3b54c1d/7b8842a0-13d7-4668-a268-67d6eb1099df",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "6032b7f2-b514-409e-9a65-bcceb975daa8",
                    "name": "Giulia",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/fe88083b-6221-4550-9dc9-8f5cbb395946/ce26fd17-e78e-4ded-94f8-0b0f29c33d8e",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "4a5a365f-23ac-443e-9f3d-0ca59b913d15",
                    "name": "Francesca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f7cbf80b-7f3f-4b7b-9e23-587d07135f67/fde545d3-a3ec-48d6-810f-b6e90bcf0b92",
                    "phases": [
                        "default"
                    ]
                }
            ]
        },
        "created_at": "2024-03-13T04:53:43Z",
        "updated_at": "2024-04-25T04:41:56Z"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

### &#x20;3. Switch chapter

switch the current chapter to other chapter.

`POST` <https://api.rpggo.ai/v2/open/game/changechapter>

**Request Body**

| Name        | Type   | Description                                                                                               |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------- |
| game\_id    | String | the unique id of the game                                                                                 |
| chapter\_id | String | the unique id of the start chapter                                                                        |
| session\_id | String | the unique id to identify the play session. The API Caller need to maintian the session\_id in its logic. |

{% code title="Sample Curl" lineNumbers="true" %}

```bash
curl --location 'https://api.rpggo.ai/v2/open/game/changechapter' \
--header 'accept: application/json' \
--header 'Authorization:$YOUR_RPGGO_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
  "chapter_id": "da08c8ff-490e-4a7f-853c-c64d8c803b15",
  "session_id": "42d029a8sdrrwqd"
}'
```

{% endcode %}

{% tabs %}
{% tab title="200: OK " %}
{% code lineNumbers="true" %}

```json
{
    "code": 0,
    "msg": "ok",
    "data": {
        "name": "📒 BAC -Break the boundaries",
        "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
        "background": "",
        "intro": "In 2102, Terminus City has clear class divides, with Mega Corporation ruling. Rebels in the Wild Hope District challenge this after a drone crash.",
        "image": "https://storage.googleapis.com/rpggo-game/rpggo-creator/5c642a81-e09a-4349-b3a2-f00156479dff/9cc4b0a4-6bfa-489a-aee8-57217a2c5cfd",
        "genre": "published",
        "user_id": "ed10dbe4-7b90-46b8-9d8c-49acbca791ee",
        "chapter": {
            "name": "The Crash",
            "chapter_id": "da08c8ff-490e-4a7f-853c-c64d8c803b15",
            "background": "Prologue - Marco (you,Player), an underground street racer from the Wild Hope District, is born with a restless nature flowing in his blood, and his sister Chiara seems equally rebellious under his influence.\n\nChiara connected her consciousness to a drone and infiltrated Terminus, but unfortunately, the drone crashed midway. The accident caused severe neurological trauma to Chiara, and angry Marco swore to find the culprit.\n\nhint:\n(Ask each character who they are)\n(Ask each character what happened before and after the accident)\n(Ask each character if they helped Chiara)\n(Ask each character the cause of the accident)",
            "intro": "None",
            "image": "",
            "background_audio": "",
            "ending_audio": "",
            "background_musics": null,
            "characters": [
                {
                    "id": "7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e",
                    "name": "Chiara",
                    "type": "dm",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/24fd170e-5116-41c8-8d93-57b148d50e42/6bb48ef3-9da7-4e6b-88a6-cc297a0e2987",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "ea1858ce-5317-4689-b940-742dbe0919c8",
                    "name": "Luca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/c47caf17-2a05-44c5-a494-47683b40aef3/f38a1fea-d364-4ee0-b7d7-fb45d9c42593",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec",
                    "name": "Alessio",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f73cd10c-23a0-4dc2-88ad-9663d3b54c1d/7b8842a0-13d7-4668-a268-67d6eb1099df",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "6032b7f2-b514-409e-9a65-bcceb975daa8",
                    "name": "Giulia",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/fe88083b-6221-4550-9dc9-8f5cbb395946/ce26fd17-e78e-4ded-94f8-0b0f29c33d8e",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "4a5a365f-23ac-443e-9f3d-0ca59b913d15",
                    "name": "Francesca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f7cbf80b-7f3f-4b7b-9e23-587d07135f67/fde545d3-a3ec-48d6-810f-b6e90bcf0b92",
                    "phases": [
                        "default"
                    ]
                }
            ]
        },
        "created_at": "2024-03-13T04:53:43Z",
        "updated_at": "2024-04-25T04:41:56Z"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

### 4. Resume the game from a previous session

if user want to continue the playing from a previous session

`POST` <https://api.rpggo.ai/v2/open/game/resumesession>

**Request Body**

| Name        | Type   | Description                                                                                               |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------- |
| game\_id    | String | the unique id of the game                                                                                 |
| session\_id | String | the unique id to identify the play session. The API Caller need to maintian the session\_id in its logic. |

{% code title="Sample Curl" overflow="wrap" lineNumbers="true" %}

```bash
curl --location 'https://api.rpggo.ai/v2/open/game/resumesession' \
--header 'accept: application/json' \
--header 'Authorization:$YOUR_RPGGO_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
  "session_id": "42d029a8sdrrwqd"
}'
```

{% endcode %}

{% tabs %}
{% tab title="200: OK " %}
{% code lineNumbers="true" %}

```json
{
    "code": 0,
    "msg": "ok",
    "data": {
        "name": "📒 BAC -Break the boundaries",
        "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
        "background": "",
        "intro": "In 2102, Terminus City has clear class divides, with Mega Corporation ruling. Rebels in the Wild Hope District challenge this after a drone crash.",
        "image": "https://storage.googleapis.com/rpggo-game/rpggo-creator/5c642a81-e09a-4349-b3a2-f00156479dff/9cc4b0a4-6bfa-489a-aee8-57217a2c5cfd",
        "genre": "published",
        "user_id": "ed10dbe4-7b90-46b8-9d8c-49acbca791ee",
        "chapter": {
            "name": "The Crash",
            "chapter_id": "da08c8ff-490e-4a7f-853c-c64d8c803b15",
            "background": "Prologue - Marco (you,Player), an underground street racer from the Wild Hope District, is born with a restless nature flowing in his blood, and his sister Chiara seems equally rebellious under his influence.\n\nChiara connected her consciousness to a drone and infiltrated Terminus, but unfortunately, the drone crashed midway. The accident caused severe neurological trauma to Chiara, and angry Marco swore to find the culprit.\n\nhint:\n(Ask each character who they are)\n(Ask each character what happened before and after the accident)\n(Ask each character if they helped Chiara)\n(Ask each character the cause of the accident)",
            "intro": "None",
            "image": "",
            "background_audio": "",
            "ending_audio": "",
            "characters": [
                {
                    "id": "7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e",
                    "name": "Chiara",
                    "type": "dm",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/24fd170e-5116-41c8-8d93-57b148d50e42/6bb48ef3-9da7-4e6b-88a6-cc297a0e2987",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "ea1858ce-5317-4689-b940-742dbe0919c8",
                    "name": "Luca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/c47caf17-2a05-44c5-a494-47683b40aef3/f38a1fea-d364-4ee0-b7d7-fb45d9c42593",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec",
                    "name": "Alessio",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f73cd10c-23a0-4dc2-88ad-9663d3b54c1d/7b8842a0-13d7-4668-a268-67d6eb1099df",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "6032b7f2-b514-409e-9a65-bcceb975daa8",
                    "name": "Giulia",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/fe88083b-6221-4550-9dc9-8f5cbb395946/ce26fd17-e78e-4ded-94f8-0b0f29c33d8e",
                    "phases": [
                        "default"
                    ]
                },
                {
                    "id": "4a5a365f-23ac-443e-9f3d-0ca59b913d15",
                    "name": "Francesca",
                    "type": "npc",
                    "avatar": "https://storage.googleapis.com/rpggo-game/rpggo-creator/f7cbf80b-7f3f-4b7b-9e23-587d07135f67/fde545d3-a3ec-48d6-810f-b6e90bcf0b92",
                    "phases": [
                        "default"
                    ]
                }
            ]
        },
        "created_at": "2024-03-13T04:53:43Z",
        "updated_at": "2024-04-25T04:41:56Z"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.rpggo.ai/dev-docs/player-api/api-overview/api-v2-new/game-control.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
