> For the complete documentation index, see [llms.txt](https://docs.podkrepi.bg/development/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podkrepi.bg/development/rest-api/endpoints/contact.md).

# Contact Request

## Create contact request

<mark style="color:green;">`POST`</mark> `https://api.podkrepi.localhost/api/v1/contact`

#### Request Body

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| email     | string |             |
| phone     | string |             |
| company   | string |             |
| message   | string |             |
| firstName | string |             |
| lastName  | string |             |

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

```javascript
{
  "id": "112cb853-b0b9-482e-a944-cf4fca5566b7",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "company": "Camplight",
  "phone": "+359888888888",
  "message": "I wanna help",
  "createdAt": "2021-03-19T00:36:50.076597738Z",
  "updatedAt": "2021-03-19T00:36:50.076597738Z",
  "deletedAt": null
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
  "statusCode": 400,
  "error": "email: non zero value required;firstName: non zero value required;lastName: non zero value required;message: non zero value required;phone: non zero value required",
  "validation": [
    {
      "field": "firstName",
      "message": "firstName: non zero value required",
      "validator": "required",
      "customMessage": false
    },
    {
      "field": "lastName",
      "message": "lastName: non zero value required",
      "validator": "required",
      "customMessage": false
    },
    {
      "field": "email",
      "message": "email: non zero value required",
      "validator": "required",
      "customMessage": false
    },
    {
      "field": "phone",
      "message": "phone: non zero value required",
      "validator": "required",
      "customMessage": false
    },
    {
      "field": "message",
      "message": "message: non zero value required",
      "validator": "required",
      "customMessage": false
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Fetch contact requests

<mark style="color:blue;">`GET`</mark> `https://api.podkrepi.localhost/api/v1/contact`

This endpoint allows you to get free cakes.

#### Headers

| Name           | Type   | Description                                                    |
| -------------- | ------ | -------------------------------------------------------------- |
| Authentication | string | Authentication token to track down who is emptying our stocks. |

{% tabs %}
{% tab title="200 List of contact requests successfully retrieved." %}

```javascript
[
  {
    "id": "0d6ff16e-ae4c-48e4-868c-05095d923053",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "company": "Camplight",
    "phone": "",
    "message": "I wanna help",
    "createdAt": "2021-03-19T00:11:21.031966Z",
    "updatedAt": "2021-03-19T00:11:21.031966Z",
    "deletedAt": null
  },
  {
    "id": "76e6e2f7-b3f2-4df4-9185-cc44185e7c86",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "company": "ACME",
    "phone": "+359888888888",
    "message": "I wanna help",
    "createdAt": "2021-03-19T00:20:31.355736Z",
    "updatedAt": "2021-03-19T00:20:31.355736Z",
    "deletedAt": null
  }
]
```

{% endtab %}
{% endtabs %}

## Fetch specific contact request

<mark style="color:blue;">`GET`</mark> `https://api.podkrepi.localhost/api/v1/contact/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| ID   | string |             |

#### Headers

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| Authentication | string |             |

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

```javascript
{
  "id": "112cb853-b0b9-482e-a944-cf4fca5566b7",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "company": "Camplight",
  "phone": "+359888888888",
  "message": "I wanna help",
  "createdAt": "2021-03-19T00:36:50.076597738Z",
  "updatedAt": "2021-03-19T00:36:50.076597738Z",
  "deletedAt": null
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "No contact found",
  "status": 404
}
```

{% endtab %}
{% endtabs %}

## Delete contact request

<mark style="color:red;">`DELETE`</mark> `https://api.podkrepi.localhost/api/v1/contact/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| Authentication | string |             |

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

```javascript
{
  "status": 200
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "status": 404
}
```

{% endtab %}
{% endtabs %}
