# DocRelay overview

> An overview of DocRelay: creating templates, issuing documents through the API, production and test environments, MCP support and tamper detection. We are preparing for launch, and the specification may change.

Source: https://docrelay.jp/en/docs/

DocRelay lets you design document layouts in the template editor and issue PDFs by sending data to the API. We are preparing for launch. The content of this page may change before launch.

## Availability

- We are preparing for launch.
- You can pre-register in the dashboard ([app.docrelay.jp](https://app.docrelay.jp/signup)). We will notify pre-registered users at launch.
- Plans and prices are on the [pricing table](https://docrelay.jp/en/#pricing) (including a Free plan; monthly, excluding tax).
- For inquiries, use the [contact page](https://docrelay.jp/en/contact/).

## Workflow

1. Create a template in the dashboard. Place text, lines, rectangles, images, line-item tables and body text in the template editor, or upload an Excel or Word file that contains merge fields.
2. Preview it with sample data, and test issuance with a test environment API key.
3. Publish a template version. Production API keys issue documents with the published version.
4. Send the template name, output format and data to `POST /v1/renders`.
5. If the document is ready within `wait` seconds, it is returned immediately. Otherwise you receive `202` with an ID, and a webhook (`render.succeeded`) on completion.
6. Share issued documents with an expiring URL, or retrieve them through the API. Documents are deleted after the retention period, and only the tamper-evident log is kept.

## Templates and output formats

- **Template types**: Layouts designed in the template editor, Excel (xlsx) and Word (docx). Uploads are limited to 10MB.
- **Output formats**: Layouts output PDF, Excel templates output Excel (xlsx) or CSV, and Word templates output Word (docx). Excel and Word files are not converted to PDF.
- **CSV output**: Use `csv` to set the line ending (CRLF or LF), the newline after the last row, the BOM, the encoding (UTF-8 or Shift_JIS) and quoting. By default, CSV is UTF-8 with a BOM and CRLF line endings. If the data contains characters that Shift_JIS cannot represent, the request fails with `422` (`unencodable`).
- **Batch issuance**: Pass 1-1,000 records in `items` to receive a zip. Layout templates can be merged into a single PDF with `merge: true`.
- **Merge fields**: `{{customer.name}}`, formatting such as `{{total | number}}` and `{{date | date:YYYY-MM-DD}}`, repeats with `{{#items}}…{{/items}}`, and page numbers `{{_page}}` and `{{_pages}}`.
- **File names**: The template’s file name setting (e.g. `invoice_{{number}}`) plus the extension. If it is not set, `<template name>_<render ID>` is used.

See the [API reference](https://docrelay.jp/en/docs/api/#layout) for the layout elements and options.

## Production and test environments

Each project has a production environment and a test environment. Templates are managed per project and shared by both environments. Issuance history is kept per environment.

- Test environment API keys (`sk_test_`) use the latest version, including drafts. Test issuance does not count toward your monthly volume.
- Production API keys (`sk_live_`) use the published version. If no version is published, the API returns `409`.

## Authentication

Send your API key in the `Authorization: Bearer` header. API keys are issued in the dashboard with the scopes you specify. The code samples read the key from the `DOCRELAY_API_KEY` environment variable.

## MCP support

DocRelay supports MCP (Model Context Protocol). Add `https://api.docrelay.jp/mcp` to an AI client such as Claude and sign in with your dashboard account to create templates, edit and publish layouts, issue documents and review issuance history from the AI. Permissions follow the same roles as the dashboard.

## Tamper detection

DocRelay provides tamper detection that applies blockchain technology. Each issued document’s SHA-256, render ID, template, version and time are chained to the previous entry, and a daily hash is published. The data you merge is never recorded.

See the [API reference](https://docrelay.jp/en/docs/api/#ledger) for details.
