> For the complete documentation index, see [llms.txt](https://docs.ushahidi.com/v3-ushahidi-platform-rest-api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ushahidi.com/v3-ushahidi-platform-rest-api-documentation/v3/messages.md).

# Messages

{% openapi src="/files/DFxnj85ZsASPYXzkPAko" path="/api/v3/messages" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## add message

<mark style="color:green;">`POST`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/messages`

#### Request Body

| Name                      | Type    | Description                            |
| ------------------------- | ------- | -------------------------------------- |
| parent\_id                | String  | The parent identifier                  |
| datetime                  | String  | Date and time                          |
| user\_id                  | String  | user ID                                |
| title                     | String  | Massage title                          |
| data\_source\_message\_id | String  | Data source message identifier         |
| message                   | String  | The main message you would like to add |
| contact\_id               | Integer | The post contact identifier            |
| data\_source              | String  | Data source                            |
| post\_id                  | String  | post ID                                |
| notification\_post\_id    | String  | Notification post identifier           |
| additional\_data          | String  | Additional information                 |
| direction                 | String  | Message direction e.g. "outgoing"      |
| status                    | String  | Message status                         |
| type                      | String  | Message type e.g. "sms"                |
| contact\_type             | String  | Contact type                           |
| contact                   | String  | Message contact                        |

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

```javascript
{
    "id": 20,
    "url": "http://localhost:8000/api/v3/messages/20",
    "user": {
        "id": 2,
        "url": "http://localhost:8000/api/v3/users/2"
    },
    "parent_id": null,
    "contact_id": 3,
    "post_id": null,
    "data_source": null,
    "data_source_message_id": null,
    "title": null,
    "message": "Another test message",
    "datetime": null,
    "type": "sms",
    "status": "pending",
    "direction": "outgoing",
    "created": "2022-11-02T15:20:45+00:00",
    "additional_data": null,
    "notification_post_id": null,
    "contact": null,
    "contact_type": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="/files/DFxnj85ZsASPYXzkPAko" path="/api/v3/messages/2" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## edit message

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/messages/18`

#### Request Body

| Name                      | Type    | Description                            |
| ------------------------- | ------- | -------------------------------------- |
| parent\_id                | String  | The parent identifier                  |
| datetime                  | String  | Date and time                          |
| user\_id                  | String  | user ID                                |
| title                     | String  | Massage title                          |
| data\_source\_message\_id | String  | Data source message identifier         |
| message                   | String  | The main message you would like to add |
| contact\_id               | Integer | The post contact identifier            |
| data\_source              | String  | Data source                            |
| post\_id                  | String  | post ID                                |
| notification\_post\_id    | String  | Notification post identifier           |
| additional\_data          | String  | Additional information                 |
| direction                 | String  | Message direction e.g. "outgoing"      |
| status                    | String  | Message status                         |
| type                      | String  | Message type e.g. "sms"                |
| contact\_type             | String  | Contact type                           |
| contact                   | String  | Message contact                        |

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

```javascript
{
    "id": 20,
    "url": "http://localhost:8000/api/v3/messages/20",
    "user": {
        "id": 2,
        "url": "http://localhost:8000/api/v3/users/2"
    },
    "parent_id": null,
    "contact_id": 3,
    "post_id": null,
    "data_source": null,
    "data_source_message_id": null,
    "title": null,
    "message": "Another test message",
    "datetime": null,
    "type": "sms",
    "status": "pending",
    "direction": "outgoing",
    "created": "2022-11-02T15:20:45+00:00",
    "additional_data": null,
    "notification_post_id": null,
    "contact": null,
    "contact_type": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="/files/DFxnj85ZsASPYXzkPAko" path="/api/v3/messages/4/post" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}
