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}/citation1 credit Failed requests are free
About this endpoint
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.
Stack Overflow Citation API 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.
Other Stack Overflow endpoints
- QuestionGET /v1/stack-overflow/questions/{questionId}
- Questions by idGET /v1/stack-overflow/questions/batch
- QuestionsGET /v1/stack-overflow/questions
- SearchGET /v1/stack-overflow/questions/search
- Similar titlesGET /v1/stack-overflow/questions/title-search
- AnswersGET /v1/stack-overflow/questions/{questionId}/answers
- CommentsGET /v1/stack-overflow/posts/{postId}/comments
- Comments by postGET /v1/stack-overflow/posts/comments