> **For coding agents and LLMs:** This is one Social Fetch marketing page (markdown export). For API orientation start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for auth and crawl rules use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for every operation use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt).

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/platforms/stack-overflow/posts-postid-citation>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/platforms/stack-overflow/posts-postid-citation.mdx>

---

# Stack Overflow Citation API

BibTeX, AMS and an example citation for a post, so you can credit it correctly.

`GET /v1/stack-overflow/posts/{postId}/citation` returns how to cite a question or an answer. `bibtex` is a complete BibTeX entry, `amsref` is an AMS reference block, and `exampleHtml` is a sentence you can adapt, with the author, title, URL and version date filled in.

A post that does not exist is HTTP 200 with `lookupStatus` of `not_found`, and the three fields are null. The content is user contributed and licensed under the terms the post carries; check `license` on the question or answer when the attribution matters.

## Request

- **Endpoint:** `GET /v1/stack-overflow/posts/{postId}/citation`
- **Credits:** 1 credit
Failed requests are free
- **Input:** by post id
- **Full reference:** [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/postid/citation/get)
- **Platform page:** [/platforms/stack-overflow](https://www.socialfetch.dev/platforms/stack-overflow)

## FAQ

### What format is bibtex in?

bibtex is one complete entry with a MISC type, the post id as its key, and fields for title, author, how it was published, note, eprint and URL. Paste it into a .bib file as it is.

### How many credits does a citation cost?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth.

### Does it work for an answer?

Yes. Pass the answer id as postId. The citation names the answer's author and links to the answer.

### What does a missing post return?

HTTP 200 with lookupStatus not_found and bibtex, amsref and exampleHtml all null.
