> For the complete documentation index, see [llms.txt](https://oobla.gitbook.io/tyche/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oobla.gitbook.io/tyche/reference/client-documents.md).

# Client documents

#### Create document

## Create client documents

<mark style="color:green;">`POST`</mark> `{base url}/v1/clients/document?clientId={clientId}`

Create client document

#### Query Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| clientId<mark style="color:red;">\*</mark> | string | client's Id |

#### Headers

| Name                                            | Type         | Description                                  |
| ----------------------------------------------- | ------------ | -------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer token | The bearer token is the API users Secret Key |

{% tabs %}
{% tab title="403: Forbidden Unauthorised " %}

```
{
    "message": "unauthorized",
    "code": 92
}
```

{% endtab %}

{% tab title="201: Created Document created successfully " %}

```json
{
    "responseCode": "00",
    "message": "Client document added successfully"
}
```

{% endtab %}

{% tab title="409: Conflict Conflict" %}

```json
{
    "message": "Document with name new file already exist",
    "code": 90
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="sample request" %}

```
{
    "docName": "new file",
    "docType": "file",
    "file": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1701158787/documents/aeyxflbnbbh4arkgfbvg"
}
```

{% endtab %}

{% tab title="sample response" %}

```
{
    "responseCode": "00",
    "message": "Client document added successfully"
}
```

{% endtab %}
{% endtabs %}

#### Get document by document id

## Get document by document id

<mark style="color:blue;">`GET`</mark> `{base url}/v1/clients/document/{documentId}`

Return document by document id

#### Query Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | string | document Id |

#### Headers

| Name                                            | Type         | Description                                  |
| ----------------------------------------------- | ------------ | -------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer token | The bearer token is the API users Secret Key |

{% tabs %}
{% tab title="403: Forbidden Unauthorised " %}

```
{
    "message": "unauthorized",
    "code": 92
}
```

{% endtab %}

{% tab title="200: OK document fetched successfully " %}

```json
{
    "responseCode": "00",
    "message": "Documents fetch successful",
    "data": [
        {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "clientId": "665b5c8a-d30d-41f1-b6e1-508562b4eecb",
            "docName": "new file",
            "docType": "file",
            "file": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "storageLocation": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "status": "active",
            "created_at": "2023-12-12T15:16:13.836Z",
            "updated_at": "2023-12-12T15:16:13.836Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="sample response" %}

```
{
    "responseCode": "00",
    "message": "Documents fetch successful",
    "data": [
        {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "clientId": "665b5c8a-d30d-41f1-b6e1-508562b4eecb",
            "docName": "new file",
            "docType": "file",
            "file": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "storageLocation": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "status": "active",
            "created_at": "2023-12-12T15:16:13.836Z",
            "updated_at": "2023-12-12T15:16:13.836Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

#### Get documents by client id

## get documents by client Id

<mark style="color:blue;">`GET`</mark> `{base url}/v1/clients/{clientId}/document`

Get documents by client Id

#### Query Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| clientId<mark style="color:red;">\*</mark> | string | client's Id |

#### Headers

| Name                                            | Type         | Description                                  |
| ----------------------------------------------- | ------------ | -------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer token | The bearer token is the API users Secret Key |

{% tabs %}
{% tab title="403: Forbidden Unauthorised " %}

```
{
    "message": "unauthorized",
    "code": 92
}
```

{% endtab %}

{% tab title="200: OK Client documents fetched successfully " %}

```json
{
    "responseCode": "00",
    "message": "Client documents fetch successful",
    "data": [
        {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "clientId": "665b5c8a-d30d-41f1-b6e1-508562b4eecb",
            "docName": "new file",
            "docType": "file",
            "file": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "storageLocation": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "status": "active",
            "created_at": "2023-12-12T15:16:13.836Z",
            "updated_at": "2023-12-12T15:16:13.836Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="sample response" %}

```
{
    "responseCode": "00",
    "message": "Client documents fetch successful",
    "data": [
        {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "clientId": "665b5c8a-d30d-41f1-b6e1-508562b4eecb",
            "docName": "new file",
            "docType": "file",
            "file": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "storageLocation": "https://res.cloudinary.com/dtui4qk9s/raw/upload/v1702394173/documents/kn9ii9jfbi6j3teyyqxl",
            "status": "active",
            "created_at": "2023-12-12T15:16:13.836Z",
            "updated_at": "2023-12-12T15:16:13.836Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

Get trial balance

## get trial balance

<mark style="color:green;">`Get`</mark> `{base url}/v1/report/accounting/trial_balance`

\<Description of the endpoint>

**Query parameters**&#x20;

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

#### Headers

| Name                                            | Type         | Description                                  |
| ----------------------------------------------- | ------------ | -------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer token | The bearer token is the API users Secret Key |

**Response**

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

```json
{
    "message": "unauthorized",
    "code": 92
}
```

{% endtab %}

{% tab title="403: Forbidden Unauthorised " %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample response" %}

```
```

{% endtab %}
{% endtabs %}
