ViewRoyal.ai API Docs
Reference

OCD Standard Reference

Open Civic Data interoperability — entity mapping, OCD ID format, and when to use the v1 API vs OCD API.

What is Open Civic Data?

Open Civic Data (OCD) is a set of specifications for representing government information in a standardized way. Originally developed for the Open States project, OCD defines common data types for jurisdictions, organizations, people, events, bills, and votes — enabling civic technology tools to work across different municipalities without custom integrations.

ViewRoyal.ai provides OCD-compliant endpoints alongside its native v1 API. The OCD endpoints transform View Royal's council data into the standardized OCD format, allowing civic tech applications that already speak OCD to consume View Royal data without modification.

The OCD endpoints are publicly accessible and do not require an API key, matching the open-data philosophy of the OCD standard.

When to Use v1 vs OCD API

Featurev1 APIOCD API
Use caseViewRoyal-specific features and richer dataCivic tech interoperability across jurisdictions
AuthenticationAPI key required (X-API-Key header)No authentication required
PaginationCursor-based (cursor parameter)Page-based (page and per_page parameters)
ID formatInteger IDs with URL slugsOCD URIs (e.g., ocd-person/{uuid})
Unique featuresSearch, Bylaws, attendance, speaking time, AI summariesStandardized entity types, cross-jurisdiction compatibility
Response envelope{ data, pagination, meta }{ results, pagination }
Best forBuilding ViewRoyal-specific applicationsMulti-jurisdiction civic tech tools

Choose v1 if you are building an application specifically for View Royal. The v1 API provides richer data (bylaws, search, AI summaries, speaking time) and cursor-based pagination for efficient traversal of large datasets.

Choose OCD if you are building a tool that needs to work across multiple municipalities, or if you want to integrate with existing OCD-compatible civic tech infrastructure.

OCD ID Format

OCD identifiers follow a hierarchical URI format. Geographic identifiers (divisions and jurisdictions) use structured paths, while entity identifiers use deterministic UUID v5 values derived from the primary key — the same entity always produces the same OCD ID.

Geographic Identifiers

Division:     ocd-division/country:ca/csd:5917047
Jurisdiction: ocd-jurisdiction/country:ca/csd:5917047/government
  • Division identifies the geographic area of View Royal using its Statistics Canada Census Subdivision (CSD) code 5917047
  • Jurisdiction identifies the governing body within that division

Entity Identifiers

Person:       ocd-person/a1b2c3d4-e5f6-5789-abcd-ef0123456789
Organization: ocd-organization/a1b2c3d4-e5f6-5789-abcd-ef0123456789
Event:        ocd-event/a1b2c3d4-e5f6-5789-abcd-ef0123456789
Bill:         ocd-bill/a1b2c3d4-e5f6-5789-abcd-ef0123456789
Vote:         ocd-vote/a1b2c3d4-e5f6-5789-abcd-ef0123456789

OCD entity UUIDs are deterministic — they are generated using UUID v5 (SHA-1 name-based) with a fixed namespace. The same View Royal entity will always produce the same OCD ID, making them stable references for external systems.

Entity Mapping

The following table shows how v1 API entities map to OCD entities:

v1 Entityv1 EndpointOCD EntityOCD EndpointNotes
Municipality(implicit)Jurisdiction/api/ocd/{municipality}/jurisdictionsThe governing body for View Royal
Organization(via meetings)Organization/api/ocd/{municipality}/organizationsCouncil, committees, boards
Person/api/v1/{municipality}/peoplePerson/api/ocd/{municipality}/peopleCouncil members and staff
Meeting/api/v1/{municipality}/meetingsEvent/api/ocd/{municipality}/eventsCouncil sessions
Matter/api/v1/{municipality}/mattersBill/api/ocd/{municipality}/billsLegislative items tracked across meetings
Motion/api/v1/{municipality}/motionsVote/api/ocd/{municipality}/votesFormal decisions with roll call
Bylaw/api/v1/{municipality}/bylawsNo OCD equivalent (ViewRoyal-specific)
Search/api/v1/{municipality}/searchNo OCD equivalent (ViewRoyal-specific)

Bylaws and Search are only available through the v1 API. The OCD standard does not define equivalent entity types for municipal bylaws or cross-content search.

OCD Endpoints

All OCD endpoints are mounted under /api/ocd/{municipality}/ where {municipality} is the URL slug (e.g., view-royal).

Discovery

GET /api/ocd/{municipality}/

Returns URLs for all available OCD entity endpoints:

{
  "jurisdictions_url": "/api/ocd/view-royal/jurisdictions",
  "organizations_url": "/api/ocd/view-royal/organizations",
  "people_url": "/api/ocd/view-royal/people",
  "events_url": "/api/ocd/view-royal/events",
  "bills_url": "/api/ocd/view-royal/bills",
  "votes_url": "/api/ocd/view-royal/votes"
}

Entity Endpoints

Each entity type supports list and detail operations:

EndpointDescription
GET /api/ocd/{municipality}/jurisdictionsList jurisdictions
GET /api/ocd/{municipality}/jurisdictions/{id}Get a jurisdiction by OCD ID
GET /api/ocd/{municipality}/organizationsList organizations
GET /api/ocd/{municipality}/organizations/{id}Get an organization by OCD ID
GET /api/ocd/{municipality}/peopleList people
GET /api/ocd/{municipality}/people/{id}Get a person by OCD ID
GET /api/ocd/{municipality}/eventsList events (meetings)
GET /api/ocd/{municipality}/events/{id}Get an event by OCD ID
GET /api/ocd/{municipality}/billsList bills (matters)
GET /api/ocd/{municipality}/bills/{id}Get a bill by OCD ID
GET /api/ocd/{municipality}/votesList votes (motions)
GET /api/ocd/{municipality}/votes/{id}Get a vote by OCD ID

Pagination

OCD list endpoints use page-based pagination:

ParameterDefaultRangeDescription
page11+Page number
per_page201–100Results per page

Response Format

List responses use the OCD envelope with results and pagination:

{
  "results": [
    {
      "id": "ocd-person/a1b2c3d4-e5f6-5789-abcd-ef0123456789",
      "name": "John Smith",
      "sort_name": "Smith, John",
      "image": null,
      "gender": null,
      "birth_date": "",
      "death_date": "",
      "created_at": "2024-01-15T10:00:00Z",
      "updated_at": "2024-01-15T10:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 20,
    "max_page": 42,
    "total_items": 837
  }
}

Detail responses return the entity directly at the top level (no wrapper object), following the OpenStates convention.

Further Reading

On this page