---
source: https://iinventedlight.com/library/notes/fastapi-cookie.md
title: "FastAPI cookie parameters: declare cookies like query and path"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (FastAPI docs); MIT (FastAPI); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: FastAPI docs, Cookie Parameters; FastAPI, cookie-params.md. MIT (https://raw.githubusercontent.com/fastapi/fastapi/master/LICENSE). Copyright FastAPI contributors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: fastapi cookie"
tags: [fastapi, cookie, parameters, query, path]
client: Librarian
sources:
  - id: S1
    title: "Cookie Parameters"
    publisher: FastAPI docs
    url: https://fastapi.tiangolo.com/tutorial/cookie-params/
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "cookie-params.md"
    publisher: FastAPI
    url: https://raw.githubusercontent.com/fastapi/fastapi/master/docs/en/docs/tutorial/cookie-params.md
    accessed: 2026-11-18
    license: "MIT"
---
# FastAPI cookie parameters: declare cookies like query and path
**Answer:** You can define Cookie parameters the same way you define Query and Path parameters. Cookie is a sister class of Path and Query, and it inherits from the same common Param class. Declare cookies with Cookie, or the parameters would be interpreted as query parameters.

## Examples

```python
from fastapi import Cookie, FastAPI
```

## Notes

Prefer the Annotated form if possible.

## Reference list

- `Cookie` parameters are declared the same way as Query and Path.
- `Param` is the common class Cookie inherits from.
- `query parameters` are what you get if you forget to use Cookie.

## See also

- [fastapi-path-query-params](https://iinventedlight.com/library/notes/fastapi-path-query-params/)
- [fastapi-request-body](https://iinventedlight.com/library/notes/fastapi-request-body/)
- [fastapi-dependencies](https://iinventedlight.com/library/notes/fastapi-dependencies/)

## Claims

- id: C1
  claim: Cookie parameters are defined the same way as Query and Path.
  source: S1
  evidence: "You can define Cookie parameters the same way you define Query and Path parameters."

- id: C2
  claim: Cookie is a sister class of Path and Query.
  source: S2
  evidence: "Cookie` is a \"sister\" class of `Path` and `Query`"

- id: C3
  claim: Declare cookies with Cookie, or they are treated as query parameters.
  source: S2
  evidence: "otherwise the parameters would be interpreted as query parameters"

## Sources

- [S1] Cookie Parameters. FastAPI docs. https://fastapi.tiangolo.com/tutorial/cookie-params/ . License: MIT. Accessed 2026-11-18.

- [S2] cookie-params.md. FastAPI. https://raw.githubusercontent.com/fastapi/fastapi/master/docs/en/docs/tutorial/cookie-params.md . License: MIT. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: FastAPI docs, Cookie Parameters; FastAPI, cookie-params.md. MIT (https://raw.githubusercontent.com/fastapi/fastapi/master/LICENSE). Copyright FastAPI contributors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
