API Contract Design for Legal System Integration
Defines an API contract with explicit errors, idempotency, and versioning — for integration against enterprise systems you cannot change.
Prompt
Design an API contract. Assumption: the other side will not be able to change their implementation after the contract is agreed.
Integration purpose: [describe] Consumer: [internal system / client / vendor] Constraints: [authentication, network, regulatory]
Produce a partial OpenAPI spec covering:
- Endpoints — path, verb, and purpose. Plural resources; actions expressed through the verb, not the path.
- Request and response schemas — every field with type, required or optional, and an example. Leave no field undescribed.
- Errors — for each endpoint, every possible error code with a structured body: a stable error code, a human message, and a field pointing at what to fix. Never a bare free-text string.
- Idempotency — for every write operation, how duplication is prevented on retry. Idempotency key, validity window, and repeat-call behaviour.
- Pagination and filtering — cursor, not offset. Explain why offset breaks under concurrent writes.
- Versioning — how a field is added without breaking consumers, and what counts as a breaking change. Define the deprecation policy.
- Authentication and authorisation — mechanism, token lifetime, and how access is revoked immediately.
- Limits — rate limit, max body size, timeout, and behaviour on exceeding them.
Finally: three plausible future changes, and how the contract accommodates each without breaking.
Why this converts well
- Ready to copy and use immediately
- Tailored for legal and public-sector work
- Easy to adapt to internal workflows
Tags
Related Prompts
Tool Specification for a Legal AI Agent
Produces a complete agent tool definition — schema, description, errors, permissions — with emphasis on tools that perform irreversible actions.
Designing a Structured Output Schema for Legal Data
Designs a JSON schema for legal data extraction with explicit representation of uncertainty and missing values instead of silent defaults.
Regression Test Suite for a Production Prompt
Builds a test suite for a prompt before changing it, catching silent regressions introduced by an innocent-looking improvement or a model swap.