text/csv
API Design

Meaning

text/csv identifies a payload as Comma-Separated Values tabular data conforming to RFC 4180. It removes the ambiguity of plain text by declaring the row/column structure so parsers, browsers, and intermediaries can interpret the body correctly. It is reached for whenever a server, client, or tool must signal that a file or HTTP body contains CSV rather than arbitrary text.

Primary Function

Content type identification

Communicative Purpose

Ensures parsers and intermediaries correctly interpret a payload as RFC 4180 CSV data instead of generic text.

Pattern

Content-Type: text/csv[; charset=<encoding>]

Função primária

Content type identification

Propósito comunicativo

Ensures parsers and intermediaries correctly interpret a payload as RFC 4180 CSV data instead of generic text.

Situações de gatilho

Web APIs: setting Content-Type on CSV download responses

Contextos

HTTP APIs, REST services, data engineering pipelines, browser file handling, ETL tools, spreadsheet import/export

Padrão

Content-Type: text/csv[; charset=<encoding>]

Colocados típicos

  • Content-Type header
  • multipart/form-data
  • file upload
  • RFC 4180
  • CSV parser
  • Accept header
  • Content-Disposition

Substituições comuns

  • application/csv: non-standard but sometimes seen — not IANA-registered
  • strict HTTP clients may reject it

Erros comuns

Using application/csv instead of text/csv — non-standard MIME type, some HTTP clients reject it Omitting the charset parameter (e.g. text/csv; charset=utf-8) — causes encoding ambiguity for non-ASCII data Setting text/csv on a response that actually returns JSON — Content-Type mismatch confuses browser download behavior and parser routing Forgetting the slash and writing textcsv or text-csv — invalid MIME syntax, header rejected by intermediaries

Similar / contraste

application/json: structured nested data vs. flat tabular text

Interferências

Coming from Excel/spreadsheet tools: may save as .csv but assume Excel auto-detects encoding — servers still need an explicit charset parameter in the MIME type

Família do chunk

  • MIME types
  • Content-Type header
  • RFC 4180
  • CSV parsing
  • multipart/form-data

Nuance

When NOT to use: when data uses non-comma delimiters (TSV, semicolons) — prefer text/tab-separated-values or a vendor-specific type

Efeito pragmático

Correct use ensures browsers trigger download dialogs with a .csv extension, APIs route payloads to CSV-specific parsers, and data pipelines apply the right delimiter and quoting rules without manual configuration.

Dica de memória

text/csv is the MIME passport that tells every intermediary — browser, proxy, parser — 'this text is structured as rows and columns, not just words.'

Upgrade path

text/csv; charset=utf-8 with strict RFC 4180 parsing, or move to application/json for nested/typed data

Frequência: Very highFormulaicidade: Fully fixedPrioridade de aquisição: Automatic productionPrioridade de output: BothTag de espaçamento: Long-term

Log in to save chunks.