{"openapi":"3.1.0","info":{"title":"MailmanAPI","version":"0.1.0","description":"Live drafts can be approved through Checkout or with an owner-authorized prepaid key. Test mail uses simulated fulfillment. MailmanAPI is operated by Legitimate LLC and is not affiliated with, endorsed by or sponsored by the United States Postal Service. USPS, Certified Mail and Priority Mail are trademarks of the United States Postal Service."},"servers":[{"url":"https://mailmanapi.com"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Products":{"type":"object","properties":{"products":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"product":{"type":"string","enum":["letter"]},"pages":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"}},"required":["min","max"]},"options":{"type":"object","properties":{"color":{"type":"object","properties":{"type":{"type":"string","enum":["boolean"]},"default":{"type":"boolean","enum":[false]}},"required":["type","default"]},"duplex":{"type":"object","properties":{"type":{"type":"string","enum":["boolean"]},"default":{"type":"boolean","enum":[false]}},"required":["type","default"]}},"required":["color","duplex"]},"services":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string","enum":["first_class","certified","certified_err"]},"label":{"type":"string"},"description":{"type":"string"},"from_total_cents":{"type":"integer","minimum":0},"from_card_total_cents":{"type":"integer","minimum":0}},"required":["service","label","description","from_total_cents"]}}},"required":["product","pages","options","services"]},{"type":"object","properties":{"product":{"type":"string","enum":["postcard"]},"sizes":{"type":"array","items":{"type":"string","enum":["4x6","6x9","6x11"]}},"services":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string","enum":["first_class","certified","certified_err"]},"label":{"type":"string"},"description":{"type":"string"},"from_total_cents":{"type":"integer","minimum":0},"from_card_total_cents":{"type":"integer","minimum":0}},"required":["service","label","description","from_total_cents"]}}},"required":["product","sizes","services"]}]}}},"required":["products"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":["string","null"]},"reason":{"type":"object","properties":{"code":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}},"required":["code","fields"]}},"required":["code","message","fix","field"]}},"required":["error"]},"Quote":{"type":"object","properties":{"product":{"type":"string","enum":["letter","postcard"]},"service":{"type":"string","enum":["first_class","certified","certified_err"]},"options":{"anyOf":[{"type":"object","properties":{"color":{"type":"boolean"},"duplex":{"type":"boolean"}},"required":["color","duplex"]},{"type":"object","properties":{"size":{"type":"string","enum":["4x6","6x9","6x11"]}},"required":["size"]}]},"pages":{"type":["integer","null"]},"line_items":{"type":"array","prefixItems":[{"type":"object","properties":{"code":{"type":"string","enum":["postage"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["printing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["fee"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}]},"provider":{"type":"string","enum":["fake","click2mail"]},"provider_cost_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0,"description":"The total from prepaid balance. In test mode without payments this is the sample total."},"card_total_cents":{"type":"integer","minimum":0},"payment_processing":{"type":"object","properties":{"code":{"type":"string","enum":["processing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},"currency":{"type":"string","enum":["usd"]}},"required":["product","service","options","pages","line_items","provider","provider_cost_cents","total_cents","currency"]},"QuoteRequest":{"type":"object","properties":{"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"object","properties":{"color":{"type":"boolean","description":"Letter printing in color when true. Defaults to false (black and white). Live color is available for First-Class letters only."},"duplex":{"type":"boolean","description":"Letter printing on both sides when true. Defaults to false (single-sided). Duplex is available in test mode only."},"size":{"type":"string","enum":["4x6","6x9","6x11"],"description":"Required postcard size in inches, one of 4x6, 6x9 or 6x11."}},"additionalProperties":false,"description":"Letters accept color and duplex, both optional. Postcards require size as their only option."},"pages":{"type":"number","description":"Number of pages in the letter, as a positive integer. Test mode allows 1–12 pages. Live mode allows 1–5 for First-Class and 1–10 for Certified with or without an electronic return receipt. A letter quote requires exactly one of pages or document. Postcard quotes omit both."},"document":{"type":"object","properties":{"pdf_base64":{"type":"string","description":"Standard base64 for an unencrypted PDF, up to 10 MiB decoded. Each page must be portrait US Letter (8.5 × 11 inches). Test mode allows 1–12 pages. Live mode allows 1–5 for First-Class and 1–10 for Certified with or without an electronic return receipt."}},"required":["pdf_base64"],"additionalProperties":false,"description":"Letter PDF used to calculate page count. Mutually exclusive with pages and unavailable for postcard quotes."}},"required":["product","service"],"additionalProperties":false},"Mailpiece":{"type":"object","properties":{"id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"object":{"type":"string","enum":["mailpiece"]},"mode":{"type":"string","enum":["test","live"]},"state":{"type":"string","enum":["draft","paid","screening","review","submitted","printed","mailed","in_transit","delivered","receipt_ready","canceled","failed","returned","refunded"]},"product":{"type":"string","enum":["letter","postcard"]},"service":{"type":"string","enum":["first_class","certified","certified_err"]},"options":{"anyOf":[{"type":"object","properties":{"color":{"type":"boolean"},"duplex":{"type":"boolean"}},"required":["color","duplex"]},{"type":"object","properties":{"size":{"type":"string","enum":["4x6","6x9","6x11"]}},"required":["size"]}]},"pages":{"type":["integer","null"]},"from":{"$ref":"#/components/schemas/PostalAddress"},"to":{"$ref":"#/components/schemas/PostalAddress"},"address_status":{"type":"string","enum":["deliverable","corrected"]},"document_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"quote":{"$ref":"#/components/schemas/Quote"},"total_cents":{"type":"integer","minimum":0},"route":{"type":"object","properties":{"provider":{"type":"string","enum":["fake","click2mail"]},"provider_product":{"type":"string"}},"required":["provider","provider_product"]},"approval_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"approval_url":{"type":["string","null"],"format":"uri"},"mail_url":{"type":"string","format":"uri"},"preview_url":{"type":"string","format":"uri"},"receipt_url":{"type":["string","null"],"format":"uri"},"tracking_number":{"type":["string","null"]},"payment":{"anyOf":[{"type":"object","properties":{"method":{"type":"string","enum":["test_mode"]},"amount_cents":{"type":"integer","minimum":0},"charged":{"type":"boolean","enum":[false]},"refund":{"type":["object","null"],"properties":{"state":{"type":"string","enum":["not_charged"]},"amount_cents":{"type":"number","enum":[0]}},"required":["state","amount_cents"]}},"required":["method","amount_cents","charged","refund"]},{"type":"object","properties":{"method":{"type":"string","enum":["card","balance"]},"amount_cents":{"type":"integer","minimum":0},"charged":{"type":"boolean"},"refund":{"type":["object","null"],"properties":{"state":{"type":"string","enum":["queued","pending","refunded","review"]},"amount_cents":{"type":"integer","minimum":0}},"required":["state","amount_cents"]}},"required":["method","amount_cents","charged","refund"]},{"type":"null"}]},"payment_notice":{"type":["string","null"]},"payment_refused":{"type":["string","null"],"enum":["refused","refunded",null]},"replacement_url":{"type":["string","null"],"format":"uri"},"reprint_of":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"cancel_until":{"type":["string","null"],"format":"date-time"},"cancel_summary":{"type":["string","null"]},"timeline":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"type":{"type":"string"},"state":{"type":["string","null"],"enum":["draft","paid","screening","review","submitted","printed","mailed","in_transit","delivered","receipt_ready","canceled","failed","returned","refunded",null]},"source":{"type":"string","enum":["api","mcp","counter","approval","pipeline","provider","usps"]},"note":{"type":"string"},"place":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["at","type","state","source","note"]}},"status":{"type":"object","properties":{"label":{"type":"string"},"person":{"type":"string"},"cancelable":{"type":"boolean"}},"required":["label","person","cancelable"]},"cancelable":{"type":"boolean"},"drafted_via":{"type":"string","enum":["api","mcp","counter"]},"to_as_given":{"allOf":[{"$ref":"#/components/schemas/PostalAddress"},{"type":["object","null"]}]},"approval":{"type":["object","null"],"properties":{"at":{"type":"string","format":"date-time"},"via":{"type":"string","enum":["approval_page","api","owner_comp"]}},"required":["at","via"]},"proof":{"type":"object","properties":{"address_layout":{"type":"object","properties":{"kind":{"type":"string","enum":["separate_sheet","first_page"]},"windows":{"type":"array","items":{"type":"object","properties":{"x_pt":{"type":"number"},"y_pt":{"type":"number"},"w_pt":{"type":"number"},"h_pt":{"type":"number"},"page":{"anyOf":[{"type":"number","enum":[0]},{"type":"number","enum":[1]}]}},"required":["x_pt","y_pt","w_pt","h_pt","page"]}}},"required":["kind","windows"]},"pages":{"type":"array","items":{"type":"object","properties":{"n":{"type":"integer","minimum":0},"label":{"type":"string"},"image_url":{"type":["string","null"],"format":"uri"},"width_pt":{"type":"number","exclusiveMinimum":0},"height_pt":{"type":"number","exclusiveMinimum":0}},"required":["n","label","image_url","width_pt","height_pt"]}},"checks":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["pages","blank_top","fits_envelope"]},"ok":{"type":"boolean"},"message":{"type":"string"},"value":{"type":"number"}},"required":["code","ok","message"]}}},"required":["address_layout","pages","checks"]},"record_url":{"type":"string","format":"uri"},"share_url":{"type":"string","format":"uri"},"possible_duplicate":{"type":["object","null"],"properties":{"id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"approved_at":{"type":"string","format":"date-time"}},"required":["id","approved_at"]},"next_step":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","object","mode","state","product","service","options","pages","from","to","address_status","document_sha256","quote","total_cents","route","approval_hash","approval_url","mail_url","preview_url","receipt_url","tracking_number","payment","cancel_until","cancel_summary","timeline","status","cancelable","drafted_via","to_as_given","approval","proof","record_url","share_url","possible_duplicate","next_step","created_at","updated_at"]},"PostalAddress":{"type":"object","properties":{"name":{"type":"string","maxLength":40,"description":"Person's name, up to 40 characters. Required when organization is absent or blank."},"organization":{"type":"string","minLength":1,"description":"Company or organization name. Required when name is absent or blank."},"line1":{"type":"string","minLength":1,"maxLength":64,"description":"Primary delivery line, such as a street address or PO Box. 1–64 characters."},"line2":{"type":"string","minLength":1,"maxLength":64,"description":"Additional delivery line, such as an apartment, suite or unit. 1–64 characters when present."},"city":{"type":"string","minLength":1,"description":"US postal city name, at least one character."},"state":{"type":"string","pattern":"^[A-Z]{2}$","description":"Two-letter uppercase USPS state code, such as PA."},"zip":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$","description":"US ZIP code as a string, with five digits or a hyphenated ZIP+4, such as 02108 or 02108-1234."}},"required":["line1","city","state","zip"],"additionalProperties":false,"description":"US postal address with a person or organization name."},"CreateMail":{"type":"object","properties":{"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard. Live fulfillment supports letters only."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"object","properties":{"color":{"type":"boolean","description":"Letter printing in color when true. Defaults to false (black and white). Live color is available for First-Class letters only."},"duplex":{"type":"boolean","description":"Letter printing on both sides when true. Defaults to false (single-sided). Duplex is available in test mode only."},"size":{"type":"string","enum":["4x6","6x9","6x11"],"description":"Required postcard size in inches, one of 4x6, 6x9 or 6x11."}},"additionalProperties":false,"description":"Letters accept color and duplex, both optional. Postcards require size as their only option."},"from":{"allOf":[{"$ref":"#/components/schemas/PostalAddress"},{"description":"Sender's US return address with a person or organization name."}]},"to":{"allOf":[{"$ref":"#/components/schemas/PostalAddress"},{"description":"Recipient's US delivery address with a person or organization name."}]},"document":{"type":"object","properties":{"text":{"type":"string","maxLength":60000,"description":"Nonblank printable letter body, up to 60,000 characters. The sender, date and recipient are added automatically. Test mode allows 1–12 pages. Live mode allows 1–5 for First-Class and 1–10 for Certified with or without an electronic return receipt. Mutually exclusive with pdf_base64."},"pdf_base64":{"type":"string","description":"Letter PDF. Standard base64 for an unencrypted PDF, up to 10 MiB decoded. Each page must be portrait US Letter (8.5 × 11 inches). Test mode allows 1–12 pages. Live mode allows 1–5 for First-Class and 1–10 for Certified with or without an electronic return receipt. Mutually exclusive with text."},"pdf_url":{"type":"string","description":"Reserved for a public HTTPS PDF URL. Hosted PDF downloads are disabled."},"front":{"type":"object","properties":{"text":{"type":"string","maxLength":60000,"description":"Unavailable for postcard fronts, which require a one-page PDF."},"pdf_base64":{"type":"string","description":"Standard base64 for a one-page unencrypted postcard front PDF, up to 10 MiB decoded."},"pdf_url":{"type":"string","description":"Reserved for a public HTTPS PDF URL. Hosted PDF downloads are disabled."}},"additionalProperties":false,"description":"Required postcard front as a one-page PDF in pdf_base64. Letters use the top-level document fields."},"back":{"type":"object","properties":{"text":{"type":"string","maxLength":60000,"description":"Nonblank printable postcard message, up to 60,000 characters, that fits the selected size. Mutually exclusive with pdf_base64."},"pdf_base64":{"type":"string","description":"Standard base64 for an unencrypted postcard back PDF with at least one page, up to 10 MiB decoded. Mutually exclusive with text."},"pdf_url":{"type":"string","description":"Reserved for a public HTTPS PDF URL. Hosted PDF downloads are disabled."}},"additionalProperties":false,"description":"Required postcard back with exactly one of text or pdf_base64. Letters use the top-level document fields."}},"additionalProperties":false,"description":"Letters require exactly one of text or pdf_base64. Postcards require both front and back, each with one content source."}},"required":["product","service","from","to","document"],"additionalProperties":false},"MailList":{"type":"object","properties":{"mail":{"type":"array","items":{"$ref":"#/components/schemas/Mailpiece"}},"next_cursor":{"type":["string","null"]}},"required":["mail","next_cursor"]},"ApproveMail":{"type":"object","properties":{"approval_hash":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"The exact approval hash from the draft, a string of 64 lowercase hexadecimal characters that identifies the draft's contents and price."}},"required":["approval_hash"],"additionalProperties":false},"AddressCheck":{"type":"object","properties":{"status":{"type":"string","enum":["deliverable","corrected","undeliverable"]},"address":{"$ref":"#/components/schemas/PostalAddress"},"message":{"type":"string"},"reason":{"type":["object","null"],"properties":{"code":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}},"required":["code","fields"]}},"required":["status","address","message","reason"]},"VerifyAddress":{"type":"object","properties":{"address":{"allOf":[{"$ref":"#/components/schemas/PostalAddress"},{"description":"US delivery address to check, with a person or organization name."}]}},"required":["address"],"additionalProperties":false},"Balance":{"type":"object","properties":{"mode":{"type":"string","enum":["test","live"]},"balance_cents":{"type":"integer","minimum":0},"currency":{"type":"string","enum":["usd"]}},"required":["mode","balance_cents","currency"]}},"parameters":{}},"paths":{"/v1/products":{"get":{"operationId":"listProducts","summary":"List available mail products and starting prices","responses":{"200":{"description":"Products and their starting prices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Products"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/quotes":{"post":{"operationId":"createQuote","summary":"Quote an itemized price","security":[{},{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequest"}}}},"responses":{"200":{"description":"Itemized quote.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail":{"post":{"operationId":"createMail","summary":"Create a mailpiece draft","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":16,"maxLength":255,"description":"Reuse this key when retrying the same body."},"required":true,"description":"Reuse this key when retrying the same body.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMail"}}}},"responses":{"200":{"description":"Current state of an idempotent draft replay.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"201":{"description":"New draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listMail","summary":"List the API key's mailpieces","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Maximum number of mailpieces per page, an integer from 1 to 100. Defaults to 20."},"required":false,"description":"Maximum number of mailpieces per page, an integer from 1 to 100. Defaults to 20.","name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"description":"Pagination token from the preceding page's next_cursor. Omitted for the first page."},"required":false,"description":"Pagination token from the preceding page's next_cursor. Omitted for the first page.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Page of mailpieces.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailList"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}":{"get":{"operationId":"getMail","summary":"Read a mailpiece and its timeline","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"responses":{"200":{"description":"Current mailpiece.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/approve":{"post":{"operationId":"approveMail","summary":"Approve a free test draft or spend from an enabled auto-send key","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveMail"}}}},"responses":{"200":{"description":"Approved mailpiece.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/cancel":{"post":{"operationId":"cancelMail","summary":"Cancel a draft or cancel a paid piece during its hold","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Canceled mailpiece.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/sample":{"post":{"operationId":"createSampleCopy","summary":"Draft a First-Class copy of this letter to the sender","description":"Creates a separate First-Class draft of the same document, addressed to the sender, priced as a normal First-Class letter. It needs its own approval. Repeating the call returns the same sample draft.","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The existing sample draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"201":{"description":"The sample draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mailpiece"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/preview":{"get":{"operationId":"getMailPreview","summary":"Download the exact document preview","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"responses":{"200":{"description":"Private PDF file.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/receipt":{"get":{"operationId":"getMailReceipt","summary":"Download a ready electronic return receipt","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"responses":{"200":{"description":"Private PDF file.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/record":{"get":{"operationId":"getMailRecord","summary":"Download the Mailing record PDF","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"responses":{"200":{"description":"Private PDF file.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mail/{id}/pages/{n}.png":{"get":{"operationId":"getMailPage","summary":"Download a draft proof page","security":[{},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","pattern":"^\\d+$"},"required":true,"name":"n","in":"path"},{"schema":{"type":"string","description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key."},"required":false,"description":"Private token from the mail_url or preview_url. Use it or the creating Bearer key.","name":"t","in":"query"}],"responses":{"200":{"description":"Grayscale proof page.","content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/addresses/verify":{"post":{"operationId":"verifyAddress","summary":"Check a US postal address","security":[{},{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyAddress"}}}},"responses":{"200":{"description":"Address verdict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressCheck"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/balance":{"get":{"operationId":"getBalance","summary":"Read an API key's balance","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Prepaid balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/balance/top-up":{"post":{"operationId":"topUpBalance","summary":"Start a balance top-up","description":"Returns the account page where a person signs in and tops up.","security":[{"bearerAuth":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"amount_cents":{"type":"integer","exclusiveMinimum":0}},"additionalProperties":false}}}},"responses":{"202":{"description":"Account link for adding funds.","content":{"application/json":{"schema":{"type":"object","properties":{"account_url":{"type":"string","format":"uri"}},"required":["account_url"]}}}},"400":{"description":"Malformed JSON or missing or malformed idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Route or mailpiece not visible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request conflicts with the current state or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Correct the inputs named in error.fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"An internal error prevented the request from completing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Payments are unavailable in Round 1.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The fulfillment provider is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mailman/turn":{"post":{"operationId":"mailmanTurn","summary":"Draft a mailpiece at the AI Mailman counter","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","pattern":"^ms_[a-z2-7]{32}$"},"message":{"type":"string","maxLength":4000},"document":{"type":"object","properties":{"pdf_base64":{"type":"string","minLength":1,"maxLength":13981016},"filename":{"type":"string","minLength":1,"maxLength":255}},"required":["pdf_base64","filename"],"additionalProperties":false}},"required":["message"],"additionalProperties":false}}}},"responses":{"200":{"description":"The current turn. Correctable preparation errors are returned as state error.","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","pattern":"^ms_[a-z2-7]{32}$"},"state":{"type":"string","enum":["asking","checking","quoting","ready_to_approve","approved","error"]},"slips":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["clerk"]},"text":{"type":"string"}},"required":["role","text"]}},"draft":{"type":["object","null"],"properties":{"mailpiece_id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"to":{"type":"object","properties":{"name":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"}},"required":["name","line1","line2","city","state","zip"]},"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard. Live fulfillment supports letters only."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"array","items":{"type":"string","enum":["return_receipt_electronic","duplex"]}},"pages":{"type":["integer","null"]},"color":{"type":"boolean"},"preview_url":{"type":"string"}},"required":["mailpiece_id","to","product","service","options","pages","color","preview_url"]},"quote":{"type":["object","null"],"properties":{"line_items":{"type":"array","prefixItems":[{"type":"object","properties":{"code":{"type":"string","enum":["postage"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["printing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["fee"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}]},"total_cents":{"type":"integer","minimum":0,"description":"The total from prepaid balance. In test mode without payments this is the sample total."},"currency":{"type":"string","enum":["usd"]},"card_total_cents":{"type":"integer","minimum":0},"payment_processing":{"type":"object","properties":{"code":{"type":"string","enum":["processing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}},"required":["line_items","total_cents","currency"]},"approve_url":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message","fix"]}},"required":["session_id","state","slips","draft","quote","approve_url","error"]}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The chat session is missing or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The previous turn is still processing.","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","pattern":"^ms_[a-z2-7]{32}$"},"state":{"type":"string","enum":["asking","checking","quoting","ready_to_approve","approved","error"]},"slips":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["clerk"]},"text":{"type":"string"}},"required":["role","text"]}},"draft":{"type":["object","null"],"properties":{"mailpiece_id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"to":{"type":"object","properties":{"name":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"}},"required":["name","line1","line2","city","state","zip"]},"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard. Live fulfillment supports letters only."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"array","items":{"type":"string","enum":["return_receipt_electronic","duplex"]}},"pages":{"type":["integer","null"]},"color":{"type":"boolean"},"preview_url":{"type":"string"}},"required":["mailpiece_id","to","product","service","options","pages","color","preview_url"]},"quote":{"type":["object","null"],"properties":{"line_items":{"type":"array","prefixItems":[{"type":"object","properties":{"code":{"type":"string","enum":["postage"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["printing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["fee"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}]},"total_cents":{"type":"integer","minimum":0,"description":"The total from prepaid balance. In test mode without payments this is the sample total."},"currency":{"type":"string","enum":["usd"]},"card_total_cents":{"type":"integer","minimum":0},"payment_processing":{"type":"object","properties":{"code":{"type":"string","enum":["processing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}},"required":["line_items","total_cents","currency"]},"approve_url":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message","fix"]}},"required":["session_id","state","slips","draft","quote","approve_url","error"]}}}},"413":{"description":"The request exceeds the upload size limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The request fields are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The chat rate limit was reached.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until requests can resume."}},"content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":["string","null"],"pattern":"^ms_[a-z2-7]{32}$"},"state":{"type":"string","enum":["asking","checking","quoting","ready_to_approve","approved","error"]},"slips":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["clerk"]},"text":{"type":"string"}},"required":["role","text"]}},"draft":{"type":["object","null"],"properties":{"mailpiece_id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"to":{"type":"object","properties":{"name":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"}},"required":["name","line1","line2","city","state","zip"]},"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard. Live fulfillment supports letters only."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"array","items":{"type":"string","enum":["return_receipt_electronic","duplex"]}},"pages":{"type":["integer","null"]},"color":{"type":"boolean"},"preview_url":{"type":"string"}},"required":["mailpiece_id","to","product","service","options","pages","color","preview_url"]},"quote":{"type":["object","null"],"properties":{"line_items":{"type":"array","prefixItems":[{"type":"object","properties":{"code":{"type":"string","enum":["postage"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["printing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["fee"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}]},"total_cents":{"type":"integer","minimum":0,"description":"The total from prepaid balance. In test mode without payments this is the sample total."},"currency":{"type":"string","enum":["usd"]},"card_total_cents":{"type":"integer","minimum":0},"payment_processing":{"type":"object","properties":{"code":{"type":"string","enum":["processing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}},"required":["line_items","total_cents","currency"]},"approve_url":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message","fix"]}},"required":["session_id","state","slips","draft","quote","approve_url","error"]}}}},"503":{"description":"The mail agent could not finish the turn.","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","pattern":"^ms_[a-z2-7]{32}$"},"state":{"type":"string","enum":["asking","checking","quoting","ready_to_approve","approved","error"]},"slips":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["clerk"]},"text":{"type":"string"}},"required":["role","text"]}},"draft":{"type":["object","null"],"properties":{"mailpiece_id":{"type":"string","pattern":"^mp_[a-z2-7]{20}$"},"to":{"type":"object","properties":{"name":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"}},"required":["name","line1","line2","city","state","zip"]},"product":{"type":"string","enum":["letter","postcard"],"description":"Physical mail format, either letter or postcard. Live fulfillment supports letters only."},"service":{"type":"string","enum":["first_class","certified","certified_err"],"description":"USPS letter service. Accepted values are first_class, certified (with tracking) and certified_err (with tracking and an electronic return receipt). Postcards support only first_class."},"options":{"type":"array","items":{"type":"string","enum":["return_receipt_electronic","duplex"]}},"pages":{"type":["integer","null"]},"color":{"type":"boolean"},"preview_url":{"type":"string"}},"required":["mailpiece_id","to","product","service","options","pages","color","preview_url"]},"quote":{"type":["object","null"],"properties":{"line_items":{"type":"array","prefixItems":[{"type":"object","properties":{"code":{"type":"string","enum":["postage"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["printing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]},{"type":"object","properties":{"code":{"type":"string","enum":["fee"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}]},"total_cents":{"type":"integer","minimum":0,"description":"The total from prepaid balance. In test mode without payments this is the sample total."},"currency":{"type":"string","enum":["usd"]},"card_total_cents":{"type":"integer","minimum":0},"payment_processing":{"type":"object","properties":{"code":{"type":"string","enum":["processing"]},"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":0}},"required":["code","label","amount_cents"]}},"required":["line_items","total_cents","currency"]},"approve_url":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message","fix"]}},"required":["session_id","state","slips","draft","quote","approve_url","error"]}}}}}}}},"webhooks":{}}