> ## 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.

# Requirements

> List and iterate extracted compliance requirements with the Law4Devs TypeScript SDK.

## Overview

Requirements are structured compliance obligations extracted from regulation articles. Each requirement is linked back to its source article and paragraph, categorised by type, and optionally includes a compliance deadline and stakeholder roles.

***

## Methods

### `list()`

Returns a page of requirements, optionally filtered to a single framework.

```typescript theme={null}
// All requirements across all frameworks
const allPage = await client.requirements.list();

// Requirements for a specific framework
const gdprPage = await client.requirements.list({ frameworkSlug: 'gdpr' });

console.log(`GDPR has ${gdprPage.meta.total} requirements`);

for (const req of gdprPage.data) {
  console.log(`Art. ${req.articleNumber} [${req.requirementType}]: ${req.requirementText.slice(0, 80)}...`);
}
```

**Parameters**

| Parameter       | Type     | Default | Description                    |
| --------------- | -------- | ------- | ------------------------------ |
| `frameworkSlug` | `string` | —       | Filter to a specific framework |
| `page`          | `number` | `1`     | Page number                    |
| `perPage`       | `number` | `20`    | Items per page (1–100)         |

**Returns** `Promise<Page<Requirement>>`

***

### `iter()`

Iterate over requirements, optionally filtered to a framework.

```typescript theme={null}
for await (const req of client.requirements.iter({ frameworkSlug: 'cra' })) {
  console.log(`[${req.requirementType}] Art. ${req.articleNumber}: ${req.requirementText.slice(0, 60)}...`);
}
```

**Parameters** — same options as `list()` (except `page`, which is managed internally).

**Returns** `AsyncGenerator<Requirement>`

***

## Model

### `Requirement`

| Field                  | Type             | Description                                                           |
| ---------------------- | ---------------- | --------------------------------------------------------------------- |
| `id`                   | `number`         | Internal numeric ID                                                   |
| `frameworkSlug`        | `string`         | Parent framework slug                                                 |
| `articleNumber`        | `number`         | Source article number                                                 |
| `paragraphRef`         | `string \| null` | Source paragraph reference, e.g. `"1"`, `"2a"`                        |
| `paragraphContent`     | `string \| null` | Full text of the source paragraph                                     |
| `requirementText`      | `string`         | Extracted requirement obligation text                                 |
| `requirementType`      | `string`         | Category, e.g. `"obligation"`, `"prohibition"`, `"right"`             |
| `complianceDeadline`   | `string \| null` | ISO 8601 deadline date, if applicable                                 |
| `linkedArticleNumbers` | `number[]`       | Related article numbers                                               |
| `stakeholderRoles`     | `string[]`       | Roles this requirement applies to, e.g. `["controller", "processor"]` |
| `tags`                 | `Tag[]`          | Tags applied to the requirement                                       |
| `createdAt`            | `string`         | ISO 8601 creation timestamp                                           |

***

## Example: build a compliance checklist

```typescript theme={null}
interface ChecklistItem {
  id: number;
  article: string;
  type: string;
  text: string;
  deadline: string | null;
  roles: string[];
}

async function buildChecklist(frameworkSlug: string): Promise<ChecklistItem[]> {
  const checklist: ChecklistItem[] = [];

  for await (const req of client.requirements.iter({ frameworkSlug })) {
    checklist.push({
      id: req.id,
      article: `Art. ${req.articleNumber}${req.paragraphRef ? `(${req.paragraphRef})` : ''}`,
      type: req.requirementType,
      text: req.requirementText,
      deadline: req.complianceDeadline,
      roles: req.stakeholderRoles,
    });
  }

  // Sort obligations before other types
  checklist.sort((a, b) => {
    if (a.type === 'obligation' && b.type !== 'obligation') return -1;
    if (b.type === 'obligation' && a.type !== 'obligation') return 1;
    return 0;
  });

  return checklist;
}

const craChecklist = await buildChecklist('cra');
console.log(`CRA compliance checklist: ${craChecklist.length} items`);
```

<Note>
  Requirements are extracted from article paragraphs through automated analysis. Cross-check against the source article text — accessible via `client.articles.get()` — for authoritative wording.
</Note>
