Home Docs Schema Formats Errors
Conduit

CSV

CSV input and output

Conduit treats CSV as a first‑class format for both input and output. CSV is ideal for spreadsheets, bulk ingestion, and interoperability with data tools.

CSV Input

To send CSV to Conduit, set the Content-Type header to text/csv.

title,created_at
Example,2024-01-01T00:00:00Z

Conduit maps CSV header columns directly into schema‑aware rows. Each row becomes a single record. CSV input behaves exactly like JSON, XML, YAML, TOML, and NDJSON — no special rules.

CSV Output

CSV output is selected when:

  • ?format=csv is used
  • Accept: text/csv is sent
  • The input format is CSV
GET /v1/books?format=csv

Example response:

id,title,created_at
1,Example,2024-01-01T00:00:00Z
2,Another,2024-01-02T00:00:00Z

Column ordering follows the database schema. Extra fields are appended alphabetically.

CSV Schema Responses

Schema endpoints return CSV describing the table’s columns, types, and metadata.

GET /v1/schema/books?format=csv

Example:

name,type,pk,autoincrement,nullable
id,INTEGER,true,true,false
title,TEXT,false,false,false
created_at,TEXT,false,false,true

CSV Error Responses

Conduit returns a consistent CSV error envelope for all error conditions. This structure matches JSON, XML, YAML, TOML, NDJSON, and CBOR.

Example CSV error:

field,value
title,Resource Not Found
message,The requested record does not exist.
status,404
documentation_url,https://docs.conduit.dev/errors/not-found
detail,No record with ID 999 exists in table 'books'.

The fields in the error envelope come directly from the ErrorSpec used by Conduit’s internal error system.

Format Negotiation

CSV is selected when:

  • ?format=csv is used
  • Accept: text/csv is sent
  • The input format is CSV
GET /v1/books?format=csv