> ## Documentation Index
> Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAPI Spec

> Machine-readable OpenAPI 3.0.3 specification for import and code generation

The Law4Devs API is fully described in an OpenAPI 3.0.3 specification. You can use
this to import the API into your preferred HTTP client, generate typed SDK code, or
run automated contract tests.

## Access the Spec

| Format | URL                                       |
| ------ | ----------------------------------------- |
| JSON   | `https://api.law4devs.eu/v1/openapi.json` |

```bash theme={null}
# Download the JSON spec
curl https://api.law4devs.eu/v1/openapi.json -o law4devs-openapi.json
```

## Import into API Clients

<Tabs>
  <Tab title="Postman">
    1. Open Postman and click **Import**
    2. Select **Link** and paste `https://api.law4devs.eu/v1/openapi.json`
    3. Click **Import** — all endpoints appear as a new collection
    4. Set the `X-API-Key` variable in the collection variables to your API key
  </Tab>

  <Tab title="Insomnia">
    1. Click **Create** → **Import from URL**
    2. Paste `https://api.law4devs.eu/v1/openapi.json`
    3. Click **Fetch and Import**
    4. Add `X-API-Key` as a header in the collection settings
  </Tab>

  <Tab title="Bruno">
    1. In your collection, click **...** → **Import**
    2. Choose **OpenAPI** and paste the spec URL or upload the downloaded file
    3. Bruno generates requests for all endpoints automatically
  </Tab>
</Tabs>

## Code Generation

Use [openapi-generator](https://openapi-generator.tech/) to generate a typed client
in any language from the spec:

```bash theme={null}
# Generate a Python client
openapi-generator generate \
  -i https://api.law4devs.eu/v1/openapi.json \
  -g python \
  -o ./generated-client

# Generate a Go client
openapi-generator generate \
  -i https://api.law4devs.eu/v1/openapi.json \
  -g go \
  -o ./generated-client
```

<Note>
  The official SDKs (Python, TypeScript, PHP) are hand-crafted and include features
  like auto-pagination and retry logic that generated clients do not provide. Use
  code generation only if your language isn't covered by an official SDK.
</Note>

## Spec Details

| Property        | Value                                   |
| --------------- | --------------------------------------- |
| Spec version    | OpenAPI 3.0.3                           |
| API version     | 1.0                                     |
| Total endpoints | 21                                      |
| Authentication  | `X-API-Key` header                      |
| Response format | JSON                                    |
| Pagination      | Cursor-based with `page` and `per_page` |

## Versioning

The current API version is `1.0`. Every response includes the `X-API-Version` header
so your application can detect version changes programmatically. Breaking changes will
increment the major version and be announced in the [Changelog](/changelog).
