# Actions

## List all actions

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/actions`

This endpoint allows you to get the list of your actions. \
The actions are returned sorted by date and time, with the most recent appearing first.

#### Headers

| Name             | Type   | Description                   |
| ---------------- | ------ | ----------------------------- |
| Authentification | string | Bearer token.                 |
| Accept           | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "id": 21,
            "name": "",
            "reference": "",
            "address": "275 Rue Paradis",
            "adresse2": "",
            "city": "Repentigny",
            "state": "QC",
            "zip": "J6A 8H2",
            "contact_name": "",
            "contact_tel": "",
            "contact_fax": "",
            "contact_email": "",
            "stop_type": "Destination",
            "date": "2020-08-13",
            "time": "",
            "hours": "",
            "broker": "",
            "note_imp": "",
            "note": "",
            "note_booking": "",
            "geotabUserId": "a2"
        },
        {
            "id": 20,
            "name": "",
            "reference": "",
            "address": "197 Rue Sainte Thérèse",
            "adresse2": "",
            "city": "Charlemagne",
            "state": "QC",
            "zip": "J5Z 1B7",
            "contact_name": "",
            "contact_tel": "",
            "contact_fax": "",
            "contact_email": "",
            "stop_type": "Origin",
            "date": "2020-08-12",
            "time": "",
            "hours": "",
            "broker": "",
            "note_imp": "",
            "note": "",
            "note_booking": "",
            "geotabUserId": "a2"
        }
    ],
    "meta": {
        "current_page": 1,
        "last_page": 1,
        "per_page": 25,
        "total": 2
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve an action

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/actions/:id`

This endpoint allows you to retrieve a specific action.

#### Path Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | integer | Action ID.  |

#### Headers

| Name             | Type   | Description                   |
| ---------------- | ------ | ----------------------------- |
| Authentification | string | Bearer token.                 |
| Accept           | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": {
        "id": 100,
        "bookingID": 135,
        "date": "2019-11-14 10:09:52",
        "user_id": 633,
        "action_id": 1,
        "value": "950.00",
        "cost": "570.00",
        "time": "00:00:00"
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Create an action

<mark style="color:green;">`POST`</mark> `https://app.gem-books.com/api/actions`

This endpoint allows you to create an action. \
Returns the created action.

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Content-Type   | string | Should be `application/json`. |
| Accept         | string | Should be `application/json`. |

#### Request Body

| Name       | Type    | Description                      |
| ---------- | ------- | -------------------------------- |
| value      | string  | Amount charged to the client.    |
| cost       | string  | Amount paid to the driver.       |
| user\_id   | integer | User ID linked to the action.    |
| action\_id | integer | Action ID.                       |
| date       | string  | Date of the action.              |
| bookingID  | integer | Booking ID linked to the action. |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

```
{
    "value" : "1.00",
    "cost" : "1.00",
    "user_id" : "633",
    "action_id" : "1",
    "date" : "2020-08-20 11:11:11",
    "bookingID" : "135"
}
```


---

# 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://docs.gem-suite.com/api-reference/resources/bookings/actions.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.
