> For the complete documentation index, see [llms.txt](https://docs.tebex.io/plugin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tebex.io/plugin/rpc.md).

# RPC

Our API design follows a **RESTful** architecture. In some cases, you may be unable to create a proper request due to limitations of the game or framework you are working with.

To work around this, you may use an implementation of jsonRPC (remote procedure call) to interact with the Plugin API.

Send a **POST** to the **/rpc** endpoint with information about the API request you want to make. It will be rebuilt into a RESTful request, forwarded to the plugin API, and the associated response will be returned to you.

<mark style="color:red;">**You must include a forward slash at the end of the URL when using RPC.**</mark>

* :white\_check\_mark:**Correct**: `https://plugin.tebex.io/rpc/`
* :x:**Incorrect**: `https://plugin.tebex.io/rpc`

Below is an example request to get a store's information via RPC.

```json
{
    "method": "GET",
    "params": {
        "SecretKey": "your-secret-key-here",
        "Path": "/information"
    }
}
```

Here is an example of a POST request using RPC.

```json
{
    "method": "POST",
    "params": {
        "SecretKey": "your-secret-key-here",
        "Path": "/checkout",
        "Body": {
            "package_id": "12345",
            "username": "foo"
        }
    }
}
```

## Make an RPC request

<mark style="color:green;">`POST`</mark> `https://plugin.tebex.io/rpc/`

#### Request Body

| Name                                               | Type   | Description                                               |
| -------------------------------------------------- | ------ | --------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>           | String | HTTP verb to use for the request (GET, POST, PUT, DELETE) |
| params<mark style="color:red;">\*</mark>           | Object | Object describing the request to be made                  |
| params.SecretKey<mark style="color:red;">\*</mark> | String | Your store's secret key.                                  |
| params.Path<mark style="color:red;">\*</mark>      | String | Your desired endpoint on the Plugin API                   |
| params.Body                                        | Object | JSON body to send to Plugin API                           |

{% tabs %}
{% tab title="200: OK Forwarded response code from Plugin API" %}
See relevant **Endpoint** for specific response information.
{% endtab %}

{% tab title="400: Bad Request Your request was formatted improperly. Ensure you send both your RPC body and params.body as valid JSON" %}

```json
{
    "error_code": 400,
    "error_message": "'Path' is required in 'params'"
}
```

{% endtab %}

{% tab title="403: Forbidden Invalid secret key" %}

{% endtab %}

{% tab title="201: Created Forwarded response code from Plugin API" %}
See relevant **Endpoint** for specific response information.
{% endtab %}

{% tab title="204: No Content Forwarded response code from Plugin API" %}
See relevant **Endpoint** for specific response information.
{% endtab %}
{% endtabs %}
