跳过主要内容

API

图片、PDF 与文件处理 API

所有响应都带有 schemaVersion、requestId、status 和结构化错误。

机器可读契约

下载 OpenAPI 3.1 文档,生成你自己的客户端或代理工具。

/api/openapi.jsonMCP 调用文档
共享工具目录

inspect_file

public · sync · 70s

Inspect uploaded bytes by fileId, or normalize explicitly supplied file facts.

upload_file

user · sync · 70s

Store an authenticated input file for later tool jobs.

validate_file

public · sync · 70s

Compare file facts with explicit submission rules.

compress_image

user · async · 70s

Compress an image to a verified byte target with optional downsampling.

inspect_image

user · async · 70s

Decode an uploaded image and inspect pixels, DPI and privacy metadata.

convert_image

user · async · 70s

Convert an image to JPEG, PNG, WebP or AVIF and remove private metadata.

resize_image

user · async · 70s

Resize an image proportionally with contain or cover fit.

crop_image

user · async · 70s

Crop an orientation-corrected image using validated pixel coordinates.

compress_pdf

user · async · 70s

Optimize a PDF and verify its actual output size and rules.

convert_image_to_pdf

user · async · 70s

Place one or more images into a checked PDF.

merge_pdfs

user · async · 70s

Merge PDFs in an explicit order and validate the result.

split_pdf

user · async · 70s

Split a PDF by a validated page range.

rotate_pdf

user · async · 70s

Rotate selected PDF pages and re-check the output.

create_submission_package

user · async · 70s

Build a named material package with a manifest and report.

get_job

user · sync · 70s

Read an authenticated asynchronous job status.

list_jobs

user · sync · 70s

List authenticated asynchronous jobs with cursor pagination.

cancel_job

user · sync · 70s

Cancel an authenticated non-terminal asynchronous job.

download_artifact

user · sync · 70s

Create an authenticated short-lived artifact download.

save_rule

user · sync · 70s

Save an authenticated reusable submission rule template.

list_rules

user · sync · 70s

List authenticated owner-scoped submission rule templates.

get_rule

user · sync · 70s

Read one authenticated owner-scoped submission rule template.

delete_rule

user · sync · 70s

Delete one authenticated owner-scoped submission rule template.

get_entitlements

user · sync · 70s

Read authenticated daily usage, quota and tool limits.

上传、任务与处理能力

图片支持 JPEG/PNG/WebP/AVIF/HEIC/HEIF/GIF/TIFF 输入及 JPEG/PNG/WebP/AVIF 输出。支持压缩、格式转换、缩放、裁剪、方向修正、元数据清除和 JPEG/PNG DPI。多帧输入使用第一帧并给出警告。

PDF 支持检查、合并、选页、旋转、多图排版和嵌入图片深度压缩;上限 25 MB、100 页,图片上限 40 MP。严格模式必须规则全部通过;尽量模式输出实际候选和警告。

工具上传在 24 小时后过期。任务产物以 expiresAt 为准。POST jobs 设置 input.execution=async,收到 202 后轮询 job;失败报告在 job.result.error.details。可用 Idempotency-Key 重放请求,用 DELETE jobs?id=JOB_ID 取消。

材料包支持 namingTemplate(name/index/type/date/ext 占位符)和规则快照,ZIP 内附 manifest 与 JSON/Markdown 逐文件报告。命名模板须以 .{ext} 结尾;严格模式拒绝不合格包。

node scripts/tools-cli.mjs run convert_image --input '{"fileId":"FILE_ID","format":"webp"}' --wait

CLI 从 ATTACHREADY_BASE_URL、ATTACHREADY_API_KEY 读取配置,支持 tools/upload/run/job/cancel/download,输出 JSON。MCP inspect_file 传 fileId 检查真实文件,传文件属性仅验证调用方声明的数据。

快速开始
curl -X POST "https://attachready.com/api/tools/validate" \
  -H 'Content-Type: application/json' \
  --data '{"file":{"name":"passport.png","mimeType":"image/png","bytes":180000},"rules":{"maxBytes":200000}}'

文件上传和任务接口需要登录会话或 Better Auth API key。

curl -H "Authorization: Bearer $API_KEY" \
  "$BASE_URL/api/tools/artifacts?id=ARTIFACT_ID"
const response = await fetch('https://attachready.com/api/tools/validate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    file: { name: 'passport.png', mimeType: 'image/png', bytes: 180000 },
    rules: { maxBytes: 200000 },
  }),
});
const result = await response.json();
import requests

result = requests.post(
    'https://attachready.com/api/tools/validate',
    json={
        'file': {'name': 'passport.png', 'mimeType': 'image/png', 'bytes': 180000},
        'rules': {'maxBytes': 200000},
    },
).json()