Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Legalize Changes API
description: Open legislation API. Every law as structured data, every reform as a diff.
version: 0.18.0
tags:
- name: Changes
paths:
/api/v1/{country}/changes:
get:
tags:
- Changes
summary: Api Changes
description: 'What changed in this country''s corpus, oldest first.
The pull half of the webhooks: same events, same `data` payload, no endpoint
to host. Poll it with `since` once, then follow `next_cursor` — that is the
only gap-free way to resume, because a night''s events all carry the same
detection timestamp.
A change is what the daily sync found: a law added, its metadata or text
updated, its status turned to repealed, or a new amendment recorded. It says
*what* moved and *when*, with the `sha` to diff against — not which article
was touched.'
operationId: api_changes_api_v1__country__changes_get
security:
- ApiKeyAuth: []
parameters:
- name: country
in: path
required: true
schema:
type: string
title: Country
- name: since
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Only changes detected on or after this date (YYYY-MM-DD).
title: Since
description: Only changes detected on or after this date (YYYY-MM-DD).
- name: cursor
in: query
required: false
schema:
anyOf:
- type: integer
minimum: 0
- type: 'null'
description: Resume after this change id. Use `next_cursor` from the previous page.
title: Cursor
description: Resume after this change id. Use `next_cursor` from the previous page.
- name: limit
in: query
required: false
schema:
type: integer
maximum: 500
minimum: 1
default: 100
title: Limit
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ChangesResponse'
application/xml:
schema:
$ref: '#/components/schemas/ChangesResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
application/xml:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'401':
description: Missing, malformed, or invalid API key
'429':
description: Monthly quota exceeded. Includes Retry-After header.
components:
schemas:
Change:
properties:
id:
type: integer
title: Id
event:
type: string
title: Event
country:
type: string
title: Country
law_id:
type: string
title: Law Id
detected_at:
type: string
format: date-time
title: Detected At
data:
additionalProperties: true
type: object
title: Data
type: object
required:
- id
- event
- country
- law_id
- detected_at
- data
title: Change
description: 'One entry of the change feed.
``data`` is byte-for-byte what a webhook POSTs for this event, so one
handler serves both the push and the pull. ``event`` is what the
``X-Legalize-Event`` header carries on the pushed copy.'
ChangesResponse:
properties:
country:
type: string
title: Country
count:
type: integer
title: Count
next_cursor:
anyOf:
- type: integer
- type: 'null'
title: Next Cursor
has_more:
type: boolean
title: Has More
changes:
items:
$ref: '#/components/schemas/Change'
type: array
title: Changes
type: object
required:
- country
- count
- next_cursor
- has_more
- changes
title: ChangesResponse
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: Authorization
description: 'Bearer token. Get one for free at https://legalize.dev/api — no credit card, 2,000 calls/month on Free. Format: `Bearer leg_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`'