> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/c/csv-file-certificates.md).

# CSV File Certificates

The CSV File Certificates adapter reads certificates from a CSV file on the connector host and adds them to the inventory.

## Use cases

* List certificates that expire within 7 days.

```
Adapters = csv-file-certificates AND ExpiryDate next now+7d/d
```

## Before you begin

### Network

| Source         | Destination                                                            | Port | Protocol |
| -------------- | ---------------------------------------------------------------------- | ---- | -------- |
| Not applicable | The file is read from the connector host. No network access is needed. | -    | -        |

### Required permissions

| Scope or role           | Permission | Needed for                                                                       |
| ----------------------- | ---------- | -------------------------------------------------------------------------------- |
| Read access to the file | Read       | The connector process must read the file in `/opt/octoxlabs/connector/media/csv` |

## Create credentials in CSV File Certificates

This adapter has no credentials. Prepare the file instead.

{% stepper %}
{% step %}

### Create the CSV file

Create a CSV file with a header row. Name the columns with the canonical column names listed in **Fields fetched** so that rows map automatically. Separate multiple values in one cell with the list separator (default `|`).
{% endstep %}

{% step %}

### Copy the file to the connector

Copy the file to `/opt/octoxlabs/connector/media/csv` on the connector host. The connector must be able to read it, so check the file permissions.
{% endstep %}

{% step %}

### Name the file

Enter the file name in the **Filename** parameter. A glob pattern such as `export_*.csv` is allowed. When several files match, the most recently modified file is used.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                 | Required | Type               | Default            | Description                                                                                                                   |
| ------------------------- | -------- | ------------------ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| Filename                  | Yes      | Text               |                    | Name or glob pattern of the CSV file, relative to `/opt/octoxlabs/connector/media/csv`. Absolute paths and `..` are rejected. |
| Primary Key Field         | No       | Text               | PrimaryKey         | Name of the column with the unique identifier of each row.                                                                    |
| Certificate Content Field | No       | Text               | CertificateContent | Column with the raw certificate PEM content.                                                                                  |
| Expiry Field              | No       | Text               | ExpiryDate         | Column with the certificate expiry date.                                                                                      |
| Separator                 | No       | Text (1 character) | ,                  | Column separator.                                                                                                             |
| List Separator            | No       | Text (1 character) | \|                 | Separator for several values in one cell.                                                                                     |
| Quote Char                | No       | Text (1 character) | "                  | Quote character for cell values.                                                                                              |

## Troubleshooting

| Error message                                                                 | Cause                                       | Fix                                                        |
| ----------------------------------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------- |
| File not found with this pattern.                                             | No file in the CSV folder matches Filename. | Copy the file to the folder and check the name or pattern. |
| No such file.                                                                 | The resolved path is not a file.            | Check Filename.                                            |
| (file name) file is empty.                                                    | The file has no header row.                 | Add a header row.                                          |
| An absolute path is not allowed; give a name relative to the adapter's folder | Filename starts with `/`.                   | Use a relative name.                                       |
| '..' is not allowed; the file must stay inside the adapter's folder           | Filename contains `..`.                     | Use a name inside the CSV folder.                          |

## Change history
