Ontocracia

API Documentation

Complete reference for the Ontocracia APIs

US Code API

Get All Titles

GET

Retrieve a list of all titles in the US Code.

/api/v1/us/code/titles

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/titles" \
     -H "Accept: application/json"

Example Response

{
  "titles": [
    {
      "number": 1,
      "name": "GENERAL PROVISIONS",
      "chapters_count": 4
    },
    {
      "number": 2,
      "name": "THE CONGRESS",
      "chapters_count": 30
    }
    // ...
  ]
}

Get Title Details

GET

Retrieve details and contents of a specific title.

/api/v1/us/code/titles/{title_number}

Path Parameters

Name Type Required Description
title_number integer Yes The number of the title to retrieve (1-54)

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/titles/1" \
     -H "Accept: application/json"

Example Response

{
  "title": {
    "number": 1,
    "name": "GENERAL PROVISIONS",
    "chapters": [
      {
        "number": 1,
        "name": "Rules of Construction",
        "sections_count": 8
      },
      // ...
    ]
  }
}

Get Chapter

GET

Retrieve a specific chapter from a title.

/api/v1/us/code/titles/{title_number}/chapters/{chapter_number}

Path Parameters

Name Type Required Description
title_number integer Yes The number of the title
chapter_number integer Yes The number of the chapter

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/titles/1/chapters/1" \
     -H "Accept: application/json"

Get Section

GET

Retrieve a specific section from a chapter.

/api/v1/us/code/titles/{title_number}/chapters/{chapter_number}/sections/{section_number}

Path Parameters

Name Type Required Description
title_number integer Yes The number of the title
chapter_number integer Yes The number of the chapter
section_number integer Yes The number of the section

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/titles/1/chapters/1/sections/1" \
     -H "Accept: application/json"

Search

GET

Search across all titles of the US Code.

Query Parameters

Name Type Required Description
q string Yes Search query term
title integer No Filter results by title number
limit integer No Maximum number of results (default: 20, max: 100)

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/search?q=congress&title=1&limit=5" \
     -H "Accept: application/json"

US Code Updates API

Get Updates

GET

Retrieve a list of recent updates to the US Code.

/api/v1/us/code/updates

Query Parameters

Name Type Required Description
limit integer No Maximum number of updates to return (default: 10)
title integer No Filter updates by title number

Example Request

curl -X GET "http://api.ontocracia.com/api/v1/us/code/updates?limit=5" \
     -H "Accept: application/json"