{"openapi":"3.1.0","info":{"title":"US Code public statute API","version":"1.0.0","description":"Read-only text from the site's published OLRC corpus. Cite each claim with inlineCitation or legalCitation including its uscode.ecfr.io link and relevant release date."},"servers":[{"url":"https://uscode.ecfr.io"}],"security":[],"paths":{"/api/v1/titles":{"get":{"operationId":"listTitles","summary":"List published U.S. Code titles","responses":{"200":{"description":"Published corpus data. Include linked citations in answers.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Metadata"},{"type":"object","properties":{"titles":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Citation"},{"type":"object","properties":{"titleNumber":{"type":"string"},"titleName":{"type":"string"},"sectionNumber":{"type":"string"},"heading":{"type":["string","null"]}}}]}}}}]}}}},"400":{"$ref":"#/components/responses/Invalid"},"405":{"$ref":"#/components/responses/Method"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/api/v1/search":{"get":{"operationId":"searchUsCode","summary":"Search text or a section citation","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":300}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":20,"default":10}}],"responses":{"200":{"description":"Published corpus data. Include linked citations in answers.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Metadata"},{"type":"object","properties":{"query":{"type":"string"},"count":{"type":"integer"},"results":{"type":"array","items":{"allOf":[{"allOf":[{"$ref":"#/components/schemas/Citation"},{"type":"object","properties":{"titleNumber":{"type":"string"},"titleName":{"type":"string"},"sectionNumber":{"type":"string"},"heading":{"type":["string","null"]}}}]},{"type":"object","properties":{"snippet":{"type":"string"},"matchType":{"type":"string"}}}]}}}}]}}}},"400":{"$ref":"#/components/responses/Invalid"},"405":{"$ref":"#/components/responses/Method"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/api/v1/section":{"get":{"operationId":"getSection","summary":"Retrieve paginated text and linked citations","parameters":[{"name":"path","in":"query","required":true,"schema":{"type":"string","maxLength":500,"example":"/title/5/section/552"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":10000000,"default":0}},{"name":"length","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":60000,"default":20000}}],"responses":{"200":{"description":"Published corpus data. Include linked citations in answers.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Metadata"},{"allOf":[{"$ref":"#/components/schemas/Citation"},{"type":"object","properties":{"titleNumber":{"type":"string"},"titleName":{"type":"string"},"sectionNumber":{"type":"string"},"heading":{"type":["string","null"]}}}]},{"type":"object","required":["text","offset","nextOffset","totalLength","complete"],"properties":{"text":{"type":"string"},"offset":{"type":"integer"},"nextOffset":{"type":["integer","null"]},"totalLength":{"type":"integer"},"complete":{"type":"boolean"}}}]}}}},"400":{"$ref":"#/components/responses/Invalid"},"404":{"$ref":"#/components/responses/Missing"},"405":{"$ref":"#/components/responses/Method"},"503":{"$ref":"#/components/responses/Unavailable"}}}}},"components":{"schemas":{"Citation":{"type":"object","required":["citation","inlineCitation","legalCitation","url","path"],"properties":{"citation":{"type":"string"},"inlineCitation":{"type":"string","description":"Markdown citation linked to uscode.ecfr.io."},"legalCitation":{"type":"string","description":"Legal citation including the site URL."},"url":{"type":"string","format":"uri"},"path":{"type":"string"}}},"Metadata":{"type":"object","required":["release","sourceDate","retrievedAt"],"properties":{"release":{"type":"object","required":["id","label","publishedAt","status"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"publishedAt":{"type":["string","null"]},"ingestedAt":{"type":["string","null"]},"status":{"type":"string"}}},"sourceDate":{"type":["string","null"],"description":"Published OLRC release date; not a real-time amendment check."},"retrievedAt":{"type":"string","format":"date-time"},"currencyNote":{"type":"string"}}}},"responses":{"Invalid":{"description":"Invalid parameters.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}},"Missing":{"description":"Section not found in this release.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}},"Method":{"description":"Read-only API. Use GET.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}},"Unavailable":{"description":"Corpus or search unavailable; not zero results.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}}