> 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/company-documents.md).

# Company documents

Get documents by companyId

## Get company documents

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

Returns paginated list of all company documents

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| companyId<mark style="color:red;">\*</mark> | string | company 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 documents fetched successfully" %}

```json
{
    "responseCode": "00",
    "status": "success",
    "message": "Company documents fetch successful",
    "data": [ {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "companyId": "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",
    "status": "success",
    "message": "Company documents fetch successful",
    "data": [ {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "companyId": "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 company documents by documentId

## Get company documents by document Id

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

Get single company 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" %}

```
{
    "responseCode": "00",
    "message": "Documents fetch successful",
    "data": [
        {
            "id": "ffbec18c-c7f3-49ed-8012-44d17b16ab5c",
            "companyId": "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",
            "companyId": "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 %}

#### Create document

## Create new document

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

Create new company document

#### Query Parameters

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

#### Headers

| Name          | Type         | Description                                  |
| ------------- | ------------ | -------------------------------------------- |
| Authorization | 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 " %}

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

{% 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": "Company document added successfully"
}
```

{% endtab %}
{% endtabs %}
