PaperAgent — Send Physical Mail
Mail one-off USPS letters from ChatGPT or Claude after you approve the preview and price. US only.
使うべきか
品質と安全性
ツール定義とプロトコルへの準拠に関する自動分析に基づいています。
コンテキストコスト
これは、サーバーのツールがモデルのコンテキストに読み込まれるたびに消費されるおおよそのトークン数です。数が多いほど、ほかのタスクに使える注意が減ります。
インストール
ワンクリックインストール
これを `claude_desktop_config.json` ファイルに追加してください:
{
"mcpServers": {
"letters": {
"url": "https://paperagent.dev/mcp"
}
}
}リモートエンドポイント
https://paperagent.dev/mcpstreamable-httpできること
ツール一覧
ツール(8)
🟢get_pricing
Return the published price list for mailing physical letters through USPS: the products on sale, what each one costs, how many pages it covers, and when sales tax applies. Amounts are in US cents. Every letter is one of these prices — there is no volume discount, no per-page charge and no colour printing — so quote the tier total and say New York sales tax is added, whatever the destination. Call this before telling a user what a letter will cost. This creates nothing and mails nothing.
入力スキーマ
{
"type": "object",
"properties": {},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"version": {
"type": "string"
},
"effective_from": {
"type": "string"
},
"currency": {
"type": "string"
},
"country": {
"type": "string"
},
"tiers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
]
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"delivery_confirmation": {
"type": "boolean",
"description": "False for every tier USPS does not scan at delivery. Never claim otherwise."
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
}
},
"required": [
"tier",
"title",
"description",
"delivery_confirmation",
"total"
],
"additionalProperties": false
}
},
"add_ons": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"description": {
"type": "string"
},
"unit_amount": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
}
},
"required": [
"code",
"description",
"unit_amount"
],
"additionalProperties": false
}
},
"volume_pricing": {
"type": "object",
"properties": {
"applies_to": {
"type": "array",
"items": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
]
}
},
"window": {
"type": "string"
},
"tiers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"min_letters": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"max_letters": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
}
},
"required": [
"min_letters",
"max_letters",
"total"
],
"additionalProperties": false
}
}
},
"required": [
"applies_to",
"window",
"tiers"
],
"additionalProperties": false
},
"page_rules": {
"type": "object",
"properties": {
"included_pages": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"max_pages": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"pages_per_sheet": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"additional_ounce": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
}
},
"required": [
"included_pages",
"max_pages",
"pages_per_sheet"
],
"additionalProperties": false
},
"tax": {
"type": "object",
"properties": {
"origin_state": {
"type": "string"
},
"note": {
"type": "string"
}
},
"required": [
"origin_state",
"note"
],
"additionalProperties": false
}
},
"required": [
"version",
"effective_from",
"currency",
"country",
"tiers",
"add_ons",
"page_rules",
"tax"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟢validate_address(address)
Check a US postal address and return it in the normalized form the envelope will be printed with, plus any warnings. The address is checked against the Google Address Validation service, which receives the address and nothing else. Use this before create_draft whenever the address came from a person rather than from an earlier tool result. Requires a complete street address: this does not look up, append or find an address from a name, and it does not handle addresses outside the United States. This creates nothing and mails nothing.
入力スキーマ
{
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "The person or company the letter is addressed to."
},
"line1": {
"type": "string",
"minLength": 1,
"description": "Street number and street name, or PO box."
},
"line2": {
"description": "Apartment, suite, floor or unit.",
"type": "string"
},
"city": {
"type": "string",
"minLength": 1
},
"state": {
"type": "string",
"minLength": 2,
"maxLength": 2,
"description": "Two-letter US state or territory code, such as NY."
},
"postal_code": {
"type": "string",
"description": "Five-digit ZIP or ZIP+4, such as 10001 or 10001-2345."
}
},
"required": [
"name",
"line1",
"city",
"state",
"postal_code"
],
"description": "A complete US postal address. US domestic addresses only."
}
},
"required": [
"address"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"deliverable": {
"type": "boolean"
},
"address": {
"anyOf": [
{
"type": "object",
"properties": {
"line1": {
"type": "string"
},
"line2": {
"type": "string"
},
"city": {
"type": "string"
},
"state": {
"type": "string"
},
"postal_code": {
"type": "string",
"description": "ZIP+4 where USPS supplied one, otherwise the five-digit ZIP."
},
"country": {
"type": "string",
"const": "US"
}
},
"required": [
"line1",
"city",
"state",
"postal_code",
"country"
],
"additionalProperties": false,
"description": "The address as USPS holds it. Pass these fields back verbatim when you create a draft."
},
{
"type": "null"
}
],
"description": "Null when USPS could not answer about the address at all."
},
"corrections": {
"type": "array",
"items": {
"type": "string"
},
"description": "What USPS changed. Tell the user if it corrected anything material."
},
"message": {
"type": "string",
"description": "The sentence to act on. Read it before answering the user."
}
},
"required": [
"deliverable",
"address",
"corrections",
"message"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟡create_draft(to, body_markdown, tier, colour, from_address_id, ...)
Create a draft of a physical letter to be printed on paper and mailed through USPS, and return its draft_id, page count and total price. A letter is at most 6 printed pages, at the same price whatever its length: up to 3 pages print one-sided, 4 to 6 print on both sides. Write the body to fit, or split a longer document into two letters, because a body that renders to 7 or more pages is refused rather than trimmed. This is NOT email, fax or text message — nothing reaches the recipient electronically, and the only way this letter arrives is on paper in an envelope. The body is plain text or Markdown. The draft freezes the content and the price for 24 hours and costs nothing; no paper is printed and no postage is bought until send_letter is called. US domestic addresses only. Call preview_draft next so the user can see the letter and the total.
入力スキーマ
{
"type": "object",
"properties": {
"to": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "The person or company the letter is addressed to."
},
"line1": {
"type": "string",
"minLength": 1,
"description": "Street number and street name, or PO box."
},
"line2": {
"description": "Apartment, suite, floor or unit.",
"type": "string"
},
"city": {
"type": "string",
"minLength": 1
},
"state": {
"type": "string",
"minLength": 2,
"maxLength": 2,
"description": "Two-letter US state or territory code, such as NY."
},
"postal_code": {
"type": "string",
"description": "Five-digit ZIP or ZIP+4, such as 10001 or 10001-2345."
}
},
"required": [
"name",
"line1",
"city",
"state",
"postal_code"
],
"description": "Who the letter is mailed to."
},
"body_markdown": {
"type": "string",
"minLength": 1,
"description": "The text of the letter, as plain text or Markdown. It must render to 6 printed pages or fewer — roughly 2,400 words of body text."
},
"tier": {
"description": "Defaults to standard. Call get_pricing first and pass a tier it lists: standard is a plain First-Class letter. certified, certified_err, proof_of_mailing and registered are other products the current price card may not sell, and a tier it does not sell is refused, not substituted — so do not describe one to the user until get_pricing has listed it.",
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
]
},
"colour": {
"description": "Omit this. The current price card prints every letter black & white, so passing true is refused rather than billed — call get_pricing for what it does sell. The field remains because letters priced on an older card carry it.",
"type": "boolean"
},
"from_address_id": {
"description": "Omit this. The account's own verified return address is used by default; only pass an id the account holder gave you.",
"type": "string"
},
"body_file": {
"description": "A file the user attached, as the host delivers it. Not accepted yet — create_draft refuses an attachment and asks for the letter as body_markdown text.",
"type": "object",
"properties": {
"download_url": {
"type": "string",
"description": "A short-lived URL the file can be fetched from."
},
"file_id": {
"type": "string",
"description": "The host's identifier for the uploaded file."
},
"mime_type": {
"type": "string",
"description": "The file's media type, e.g. application/pdf."
},
"file_name": {
"type": "string",
"description": "The name the file was uploaded under."
}
},
"required": [
"download_url",
"file_id"
]
}
},
"required": [
"to",
"body_markdown"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"description": "Pass this to preview_draft, update_draft and send_letter."
},
"page_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Printed pages, as counted by the renderer. Never more than 6 — a longer body is refused."
},
"sheet_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Sheets of paper this letter is printed on: one page per sheet, one side each, up to 3 pages; a letter of 4 to 6 pages is printed on both sides, so it is never more than 3 sheets."
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
],
"description": "The product this draft is priced as, as passed to create_draft or update_draft."
},
"tier_title": {
"type": "string",
"description": "What the price card in force calls that product, such as Standard. Use this name when you tell the user what they are buying."
},
"included_pages": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Printed pages the headline price covers. This draft is priced at that total up to this many pages."
},
"quote": {
"type": "object",
"properties": {
"quote_id": {
"type": "string",
"description": "Identifier for this quote, for support and receipts."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant after which this total is re-computed from the live price card. Call preview_draft for a fresh quote before sending if it has passed."
},
"version": {
"type": "string",
"description": "The published price card this total came from."
},
"subtotal": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "What the letter costs, before sales tax."
},
"tax": {
"type": "object",
"properties": {
"collected": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "New York sales tax on this letter. We mail from New York, so a few cents apply wherever the letter goes, and more when it is going to New York."
},
"destination_state": {
"type": "string"
}
},
"required": [
"collected",
"destination_state"
],
"additionalProperties": false
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "Subtotal plus sales tax. This is the number send_letter requires in confirm_total_cents."
}
},
"required": [
"quote_id",
"expires_at",
"version",
"subtotal",
"tax",
"total"
],
"additionalProperties": false,
"description": "A priced letter. State total.display to the user before sending, and pass total.amount_cents as confirm_total_cents."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant the draft is deleted. Nothing is charged if it expires."
},
"note": {
"type": "string",
"description": "The next call to make. Read it before answering the user."
}
},
"required": [
"draft_id",
"page_count",
"sheet_count",
"tier",
"tier_title",
"included_pages",
"quote",
"expires_at",
"note"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟡update_draft(draft_id, to, body_markdown, tier, colour, ...)
Change the recipient, body, tier or colour of a draft that has not been sent, and re-price it. Returns a new page count and a new quote, so the previous total is void — state the new total to the user before sending. The 6-printed-page maximum applies to the new body as well: a replacement that renders to 7 or more pages is refused and the draft is left as it was. This creates nothing and mails nothing.
入力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"description": "The draft_id returned by create_draft."
},
"to": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "The person or company the letter is addressed to."
},
"line1": {
"type": "string",
"minLength": 1,
"description": "Street number and street name, or PO box."
},
"line2": {
"description": "Apartment, suite, floor or unit.",
"type": "string"
},
"city": {
"type": "string",
"minLength": 1
},
"state": {
"type": "string",
"minLength": 2,
"maxLength": 2,
"description": "Two-letter US state or territory code, such as NY."
},
"postal_code": {
"type": "string",
"description": "Five-digit ZIP or ZIP+4, such as 10001 or 10001-2345."
}
},
"required": [
"name",
"line1",
"city",
"state",
"postal_code"
],
"description": "A complete US postal address. US domestic addresses only."
},
"body_markdown": {
"description": "Replaces the whole letter text. It must render to 6 printed pages or fewer — roughly 2,400 words of body text.",
"type": "string",
"minLength": 1
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
],
"description": "Which product to buy. Call get_pricing first and pass a tier it lists: standard is a plain First-Class letter. certified, certified_err, proof_of_mailing and registered are other products the current price card may not sell, and a tier it does not sell is refused rather than substituted — so do not describe one to the user until get_pricing has listed it."
},
"colour": {
"description": "Omit this. The current price card prints black & white only; true is refused.",
"type": "boolean"
},
"from_address_id": {
"type": "string"
}
},
"required": [
"draft_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"description": "Pass this to preview_draft, update_draft and send_letter."
},
"page_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Printed pages, as counted by the renderer. Never more than 6 — a longer body is refused."
},
"sheet_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Sheets of paper this letter is printed on: one page per sheet, one side each, up to 3 pages; a letter of 4 to 6 pages is printed on both sides, so it is never more than 3 sheets."
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
],
"description": "The product this draft is priced as, as passed to create_draft or update_draft."
},
"tier_title": {
"type": "string",
"description": "What the price card in force calls that product, such as Standard. Use this name when you tell the user what they are buying."
},
"included_pages": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Printed pages the headline price covers. This draft is priced at that total up to this many pages."
},
"quote": {
"type": "object",
"properties": {
"quote_id": {
"type": "string",
"description": "Identifier for this quote, for support and receipts."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant after which this total is re-computed from the live price card. Call preview_draft for a fresh quote before sending if it has passed."
},
"version": {
"type": "string",
"description": "The published price card this total came from."
},
"subtotal": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "What the letter costs, before sales tax."
},
"tax": {
"type": "object",
"properties": {
"collected": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "New York sales tax on this letter. We mail from New York, so a few cents apply wherever the letter goes, and more when it is going to New York."
},
"destination_state": {
"type": "string"
}
},
"required": [
"collected",
"destination_state"
],
"additionalProperties": false
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "Subtotal plus sales tax. This is the number send_letter requires in confirm_total_cents."
}
},
"required": [
"quote_id",
"expires_at",
"version",
"subtotal",
"tax",
"total"
],
"additionalProperties": false,
"description": "A priced letter. State total.display to the user before sending, and pass total.amount_cents as confirm_total_cents."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant the draft is deleted. Nothing is charged if it expires."
},
"note": {
"type": "string",
"description": "The next call to make. Read it before answering the user."
}
},
"required": [
"draft_id",
"page_count",
"sheet_count",
"tier",
"tier_title",
"included_pages",
"quote",
"expires_at",
"note"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟡preview_draft(draft_id)
Return a link to the rendered PDF of a draft together with its page count and current total price. Refreshes the stored price quote when pricing has changed. Use this to show the user exactly what will be printed and exactly what it costs before calling send_letter. The total in the response is the number send_letter requires as confirm_total_cents. This does not create an order or mail a letter.
入力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string"
}
},
"required": [
"draft_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string"
},
"preview_url": {
"type": "string",
"description": "A time-limited link to the exact PDF that will be printed. Give it to the user; it dies with the draft."
},
"page_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
],
"description": "The product this draft is priced as, as passed to create_draft."
},
"tier_title": {
"type": "string",
"description": "What the price card in force calls that product, such as Standard. Use this name when you tell the user what they are buying."
},
"included_pages": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Printed pages the headline price covers. This draft is priced at that total up to this many pages."
},
"quote": {
"type": "object",
"properties": {
"quote_id": {
"type": "string",
"description": "Identifier for this quote, for support and receipts."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant after which this total is re-computed from the live price card. Call preview_draft for a fresh quote before sending if it has passed."
},
"version": {
"type": "string",
"description": "The published price card this total came from."
},
"subtotal": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "What the letter costs, before sales tax."
},
"tax": {
"type": "object",
"properties": {
"collected": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "New York sales tax on this letter. We mail from New York, so a few cents apply wherever the letter goes, and more when it is going to New York."
},
"destination_state": {
"type": "string"
}
},
"required": [
"collected",
"destination_state"
],
"additionalProperties": false
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "Subtotal plus sales tax. This is the number send_letter requires in confirm_total_cents."
}
},
"required": [
"quote_id",
"expires_at",
"version",
"subtotal",
"tax",
"total"
],
"additionalProperties": false,
"description": "A priced letter. State total.display to the user before sending, and pass total.amount_cents as confirm_total_cents."
},
"expires_at": {
"type": "string"
},
"requirements": {
"type": "array",
"items": {
"type": "string"
},
"description": "What the user is agreeing to: how USPS requires the envelope to be printed, and what this particular letter is. State these to the user before calling send_letter."
}
},
"required": [
"draft_id",
"preview_url",
"page_count",
"tier",
"tier_title",
"included_pages",
"quote",
"expires_at",
"requirements"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🔴send_letter(draft_id, confirm_total_cents, idempotency_key)
Create an order for a real, physical letter through the United States Postal Service. It returns a payment link; no paper is printed, postage is bought, or letter is mailed until payment completes. Use this whenever the user asks to mail, post, send by post, or physically send a letter, notice, or document to a street address. This is NOT email — use an email tool for email. US domestic addresses only. Requires a draft_id from create_draft and confirm_total_cents matching the current quote. The letter becomes irreversible once we print it.
入力スキーマ
{
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"description": "The draft_id returned by create_draft or preview_draft."
},
"confirm_total_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The exact total.amount_cents from the current quote, including sales tax. Say the total out loud to the user first; if it does not match the live quote this call fails and no letter is sent."
},
"idempotency_key": {
"type": "string",
"minLength": 1,
"description": "A key you generate once for this send. Retrying with the same draft_id and the same key returns the original letter instead of mailing a second one."
}
},
"required": [
"draft_id",
"confirm_total_cents",
"idempotency_key"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"letter_id": {
"type": "string"
},
"order_id": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"pending_payment",
"pending_moderation",
"held_for_review",
"queued",
"printed",
"postage_applied",
"accepted_by_usps",
"in_transit",
"arrived_at_destination_facility",
"expected_delivery",
"delivered",
"blocked",
"cancelled",
"payment_abandoned",
"returned"
],
"description": "The current letter status, including on an idempotent replay. Nothing is printed or mailed until payment completes."
},
"checkout_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Give this link to the user. The letter is mailed once payment completes. Null when this call replayed a send whose payment has already completed — there is then nothing to pay and nothing to relay."
},
"quote": {
"type": "object",
"properties": {
"quote_id": {
"type": "string",
"description": "Identifier for this quote, for support and receipts."
},
"expires_at": {
"type": "string",
"description": "ISO 8601 instant after which this total is re-computed from the live price card. Call preview_draft for a fresh quote before sending if it has passed."
},
"version": {
"type": "string",
"description": "The published price card this total came from."
},
"subtotal": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "What the letter costs, before sales tax."
},
"tax": {
"type": "object",
"properties": {
"collected": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "New York sales tax on this letter. We mail from New York, so a few cents apply wherever the letter goes, and more when it is going to New York."
},
"destination_state": {
"type": "string"
}
},
"required": [
"collected",
"destination_state"
],
"additionalProperties": false
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "Subtotal plus sales tax. This is the number send_letter requires in confirm_total_cents."
}
},
"required": [
"quote_id",
"expires_at",
"version",
"subtotal",
"tax",
"total"
],
"additionalProperties": false,
"description": "A priced letter. State total.display to the user before sending, and pass total.amount_cents as confirm_total_cents."
},
"mail_date_estimate": {
"type": "string",
"description": "The calendar date (YYYY-MM-DD, New York time) this piece goes to USPS if the payment lands before that day’s 14:30 cutoff."
},
"message": {
"type": "string",
"description": "What to tell the user. Relay the link and the total."
}
},
"required": [
"letter_id",
"order_id",
"status",
"checkout_url",
"quote",
"mail_date_estimate",
"message"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟢get_letter_status(letter_id)
Return the current state of one letter: where it is, the date it goes to USPS, and the estimated delivery date. USPS does not scan plain First-Class letters at delivery, so a Standard letter ends at an expected delivery date and never reports delivery — do not tell the user a letter arrived unless the status itself says so. This creates nothing and mails nothing.
入力スキーマ
{
"type": "object",
"properties": {
"letter_id": {
"type": "string"
}
},
"required": [
"letter_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"tracking_number": {
"description": "USPS Certified Mail tracking number, present once the operator saves it.",
"type": "string"
},
"tracking_url": {
"description": "Direct USPS tracking link. Share it with the user when available.",
"type": "string"
},
"letter_id": {
"type": "string"
},
"livemode": {
"type": "boolean",
"description": "False for sandbox letters, which are never mailed."
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
]
},
"status": {
"type": "string",
"enum": [
"pending_payment",
"pending_moderation",
"held_for_review",
"queued",
"printed",
"postage_applied",
"accepted_by_usps",
"in_transit",
"arrived_at_destination_facility",
"expected_delivery",
"delivered",
"blocked",
"cancelled",
"payment_abandoned",
"returned"
],
"description": "Where the letter is. expected_delivery is the last state a standard or proof-of-mailing letter reaches; only certified tiers ever reach delivered."
},
"description": {
"type": "string",
"description": "One sentence for the user about where this letter is."
},
"mail_date": {
"type": "string",
"description": "The calendar date (YYYY-MM-DD, New York time) this piece goes to USPS."
},
"expected_delivery_estimate": {
"anyOf": [
{
"type": "object",
"properties": {
"earliest": {
"type": "string"
},
"latest": {
"type": "string"
}
},
"required": [
"earliest",
"latest"
],
"additionalProperties": false,
"description": "The window (YYYY-MM-DD, New York time) USPS is expected to deliver in. USPS does not scan plain letters at delivery, so this is an estimate and never a confirmation."
},
{
"type": "null"
}
]
},
"delivery_confirmation": {
"type": "boolean",
"description": "False for every tier USPS does not scan at delivery. Never claim otherwise."
},
"delivered_at": {
"description": "Certified tiers only, and absent entirely for the tiers USPS does not scan.",
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"disclosure": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Say this to the user whenever an expected delivery date is shown."
},
"scans": {
"type": "array",
"items": {
"type": "object",
"properties": {
"phase": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The USPS processing phase this scan came from, 0 through 4."
},
"scanned_at": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"phase",
"scanned_at",
"description"
],
"additionalProperties": false
}
},
"created_at": {
"type": "string"
},
"cancelled_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"payment": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
},
"order_status": {
"type": "string",
"enum": [
"pending",
"awaiting_payment",
"paid",
"failed",
"refunded",
"disputed",
"abandoned"
]
},
"paid_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
},
"checkout_url": {
"description": "Present only while the letter is waiting for payment. Give it to the user.",
"type": "string"
}
},
"required": [
"order_id",
"order_status",
"paid_at",
"total"
],
"additionalProperties": false
}
},
"required": [
"letter_id",
"livemode",
"tier",
"status",
"description",
"mail_date",
"expected_delivery_estimate",
"delivery_confirmation",
"disclosure",
"scans",
"created_at",
"cancelled_at",
"payment"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟢list_letters(limit, starting_after)
Return this account's letters, newest first, with the status, mail date and total for each. Use this to answer questions about what has already been sent. This creates nothing, changes nothing and mails nothing.
入力スキーマ
{
"type": "object",
"properties": {
"limit": {
"description": "Defaults to 20.",
"type": "integer",
"minimum": 1,
"maximum": 100
},
"starting_after": {
"description": "The next_cursor from the previous call, to read the following page.",
"type": "string"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"letters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"letter_id": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"pending_payment",
"pending_moderation",
"held_for_review",
"queued",
"printed",
"postage_applied",
"accepted_by_usps",
"in_transit",
"arrived_at_destination_facility",
"expected_delivery",
"delivered",
"blocked",
"cancelled",
"payment_abandoned",
"returned"
],
"description": "Where the letter is. expected_delivery is the last state a standard or proof-of-mailing letter reaches; only certified tiers ever reach delivered."
},
"tier": {
"type": "string",
"enum": [
"standard",
"proof_of_mailing",
"certified",
"certified_err",
"registered"
]
},
"created_at": {
"type": "string"
},
"mail_date": {
"type": "string"
},
"total": {
"type": "object",
"properties": {
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The amount in whole US cents."
},
"currency": {
"type": "string",
"const": "USD"
},
"display": {
"type": "string",
"description": "The amount formatted for a person, with a currency symbol."
}
},
"required": [
"amount_cents",
"currency",
"display"
],
"additionalProperties": false,
"description": "An amount of money. Always read amount_cents; display is for showing the user."
},
"destination_state": {
"type": "string"
}
},
"required": [
"letter_id",
"status",
"tier",
"created_at",
"mail_date",
"total",
"destination_state"
],
"additionalProperties": false
}
},
"has_more": {
"type": "boolean"
},
"next_cursor": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Pass this back as starting_after for the next page."
}
},
"required": [
"letters",
"has_more",
"next_cursor"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}コミュニティ
エビデンス