# MakeLeaps API Documentation - Sending Section ## Navigation - [Back to index](/api/llms.txt) - [Current section](/api/llms/sending.md) ## Topics in this Section - Sending Orders - Sending Order Item - Secure Inbox - Received Document - Accepted Order ## Sending Orders ### Endpoints - `/api/partner//sending/order/` - Name: Sending Order List - Methods: GET, POST, OPTIONS - `/api/partner//sending/order//` - Name: (No Name) - Methods: GET, PUT, PATCH, DELETE, OPTIONS Sending Orders -------------- A Sending Order is a request to send document(s) via MakeLeaps' Sending Method(s). The flow to successfully send documents is as follows: 1. Create a Sending Order with the desired options. 2. Attach one or more Sending Order Items to the Sending Order. 3. Wait for the system to validate the Sending Order to make sure it is sendable. Make any needed corrections if it isn't. 4. Execute the Sending Order. After a Sending Order has been executed, depending on the selected sending options and current status, it may be possible to cancel it. Creating a Sending Order ------------------------ POST /api/partner//sending/order/ Sample data: { "recipient_organization": , "send_to_clientinbox_selected": true, "securesend_selected": true, "to_emails": ["myclient@example.com"], "subject": "Invoices for August", "message": "Invoices are attached. Thank you for your business.", "enable_cc_payments": true, "sendbypost_selected": true, "stamp_type": "invoice", "recipient_contact_organization_name": "My Client", "recipient_contact_department": "Accounts Dept.", "recipient_contact_title": "Director", "recipient_contact_name": "Jane Smith", "recipient_honorific": "様", "recipient_address": { "address_format": "jp_default", "country": "JP", "street_address": "Main St.", "extended_address": "ABC Bldg. #123", "locality": "Shinjuku-ku", "region": "tokyo", "postal_code": "000-0000" }, "sender_contact_organization_name": "My Company", "sender_contact_phone_number": "12-3456-7890", "sender_address": { "address_format": "jp_default", "country": "JP", "street_address": "Main St.", "extended_address": "ABC Bld.g #456", "locality": "Shinjuku-ku", "region": "tokyo", "postal_code": "000-0000" }, "status": { "url": "", "securesend": "not_viewed", "send_to_clientinbox": "viewed", "sendbypost": "preparing", "securesend_cancelled": false, "send_to_clientinbox_cancelled": false, "sendbypost_cancelled": false }, } ### General Options Option(s) that affect all Sending Orders. * `recipient_organization` ### Payment Options Option(s) that only apply to processing of electronic sending methods where Clients can use MakeLeaps Payments (Secure Send and Send via Client Inbox). * `enable_cc_payments` ### "Send via Client Inbox"-specific Options * `send_to_clientinbox_selected` ### "Secure Send"-specific Options * `securesend_selected` * `to_emails` * `subject` * `message` ### "Send by Post"-specific Options * `sendbypost_selected` * `stamp_type` * `recipient_contact_organization_name` * `recipient_contact_department` * `recipient_contact_title` * `recipient_contact_name` * `recipient_honorific` * `recipient_address` * `sender_contact_organization_name` * `sender_contact_phone_number` * `sender_address` Adding and deleting Sending Order Items --------------------------------------- ### Adding an in-app document POST Sample data: { "position": 0, "document": } ### Attaching a custom file Files undergo validation when they are attached to a Sending Order, which can take some time depending on the file. Because of this, it is recommended to use async upload using Tasks. #### Asynchronous uploads with Tasks (Recommended) First, add the Sending Order Item. POST Sample Data { "position": 1, ""filename"": ""flyer.pdf"" } Next, upload the custom file to the async_upload_url that is included in the POST's response. PUT Sample headers and data Content-Type: 'multipart/form-data; boundary=----------a_BoUnDaRy759443597973$' ------------a_BoUnDaRy759443597973$ Content-Disposition: form-data; name=""content_file""; filename=""filename.pdf"" Content-Type: application/pdf ------------a_BoUnDaRy759443597973$-- The response to a PUT to `async_upload_url` will be a Task instance. For more on using Tasks, please see the [Task](#task) section. For asynchronous uploads of custom files, a GET of Task's `result_url` will return the corresponding Sending Order Item instance. (Same as a GET of the Sending Order Item's `url`) A full list of Sending Order Item's asynchronous upload tasks can be obtained via a GET to the Item's `async_upload_tasks_url`. ### Synchronous uploads without Tasks The flow of synchronous uploads is basically the same as asynchronous, with the following 2 differences. - The upload is PUT to upload_url, not async_upload_url. - The response to the upload PUT is a Sending Order Item instance, not a Task. ### Deleting an item DELETE Executing an order ------------------ If the `ready_to_order` field of a Sending Order is not `true`, it's not possible to send it. It may be that it's still being validated by the system, or it may be that there are problems with the selected options and they need to be modified. Any problems in the order will be listed in the `validation_errors` field. To execute the Sending Order when it's ready: POST Sample data: { } Tracking the status of an order ------------------------------- The `status` field contains information about the latest status of each selected sending method, and an URL for cancellation. { "url": "", "securesend": "not_viewed", "send_to_clientinbox": "viewed", "sendbypost": "preparing", "securesend_cancelled": false, "send_to_clientinbox_cancelled": false, "sendbypost_cancelled": false } ### Send via Client Inbox Status is in `send_to_clientinbox`. Possible values are: * `not_selected` - "Send via Client Inbox" is/was not selected as a sending method on the Order. * `draft` - "Send via Client Inbox" selected but Order not yet executed. * `not_viewed` - "Send via Client Inbox" executed but not yet viewed. * `cancelled` - "Send via Client Inbox" executed but cancelled before it was viewed. * `viewed` - "Send via Client Inbox" executed and already seen by the client. ### Secure Send Status is in `securesend`. Possible values are: * `not_selected` - "Secure Send" is/was not selected as a sending method on the Order. * `draft` - "Secure Send" selected but Order not yet executed. * `not_viewed` - "Secure Send" executed but not yet viewed. * `cancelled` - "Secure Send" executed but cancelled before it was viewed. * `viewed` - "Secure Send" executed and already viewed. ### Send by Post Status is in `sendbypost`. Possible values are: * `not_selected` - "Send by Post" is/was not selected as a sending method on the Order. * `draft` - "Send by Post" selected but Order not yet executed. * `can_cancel` - "Send by Post" executed but can be cancelled. * `cancelled` - "Send by Post" executed but cancelled in 30-minute grace period. Nothing will be/was mailed. * `preparing` - "Send by Post" executed and cannot be cancelled. Currently being prepared for mailing. * `mailed` - "Send by Post" executed and the Order was mailed. * `info_not_available` - information about this order is unavailable. Cancelling after sending ------------------------ If the Sending Order had more than one sending method selected, you can cancel all or selectively cancel a single one. POST Sample data: { "securesend_cancelled": true, "send_to_clientinbox_cancelled": true, "sendbypost_cancelled": false } Scheduling a Sending Order's execution -------------------------------------- Set the `date_scheduled` field to schedule the execution of a Sending Order. MakeLeaps servers will execute the Order automatically after its `date_scheduled` has passed. A Sending Order that has a non-null `date_scheduled` is called a "Scheduled Sending Order". Notes: - `date_scheduled` should be specified in UTC (Z format). Do not forget to convert your desired datetime from your timezone to UTC. - `date_scheduled` must meet be both - after current server time, and - before midnight of the day 35 days after server's current UTC date. - Schedule Sending Orders are processed in twice hourly batches (:00 and :30). Because of this, Orders reserved for 00:05 will be run at 00:30. To avoid confusion, `date_scheduled` values of :00 or :30 are recommended. - `date_scheduled` needs to be specified to at least the minute. - Scheduled Sending Orders will no longer accept `PATCH` requests, only `DELETE`. - If `date_scheduled` is not specified in a request's data, its value will be assumed to be null and the Sending Order will be a draft. Draft orders need to be sent via a request to the `send_url`. Sample PUT/PATCH data (this would send at 9am JST, Nov 11, 2023): Sample data: { ... "date_scheduled": "2023-11-11T00:00:00Z", ... } Discard a Scheduled Send ------------------------ Since Scheduled Sending Orders cannot be altered, they must be deleted using a `DELETE` request and then recreated. ### Fields - **`url`** `Read-Only` - **Type**: `URL` - **`send_url`** `Read-Only` - **Type**: `URL` - **`recipient_organization`** `Required` `Expandable` - **Type**: `Client URL (Expandable)` - **Description**: Client - **`employee`** `Read-Only` `Expandable` - **Type**: `URL` - **Description**: Employee URL - **`securesend_selected`** - **Type**: `Boolean` - **Description**: Secure Send - **`to_emails`** - **Type**: `Array of String` - **Description**: Email Addresses - **`send_to_contacts`** - **Type**: `Array of URL` - **Description**: Contacts - **`subject`** - **Type**: `String` - **Description**: Subject - **`message`** - **Type**: `String` - **Description**: Message - **`enable_cc_payments`** - **Type**: `Boolean` - **Description**: Enable Credit Card Payments - **`sendbypost_selected`** - **Type**: `Boolean` - **Description**: Japan Post - **`send_to_clientinbox_selected`** - **Type**: `Boolean` - **Description**: Send via Client Inbox - **`stamp_type`** - **Type**: `One of ['quote', 'orderslip', 'orderconfirmation', 'deliveryslip', 'acceptance', 'paymentnotice', 'invoice', 'receipt', 'nostamp', 'many_documents']` - **Description**: Envelope Stamp - **`ready_to_order`** `Read-Only` - **Type**: `Boolean` - **`pdf_content_url`** `Read-Only` - **Type**: `URL` - **`recipient_contact_organization_name`** - **Type**: `String` - **Description**: Client Name - **`recipient_contact_department`** - **Type**: `String` - **Description**: Department - **`recipient_contact_title`** - **Type**: `String` - **Description**: Title - **`recipient_contact_name`** - **Type**: `String` - **Description**: Contact Name - **`recipient_honorific`** - **Type**: `String` - **Description**: Recipient Honorific - **`recipient_address`** - **Type**: `Address` - **Description**: Address - **`sender_contact_organization_name`** - **Type**: `String` - **Description**: Sender Company Name - **`sender_contact_phone_number`** - **Type**: `String` - **Description**: Phone Number - **`sender_address`** - **Type**: `Address` - **Description**: Address - **`validation_errors`** `Read-Only` - **Type**: `String` - **`items`** `Read-Only` - **Type**: `Array of Sending Order Item` - **`items_url`** `Read-Only` - **Type**: `URL` - **`status`** `Read-Only` - **Type**: `String` - **Description**: Status - **`external_id`** - **Type**: `String` - **Description**: External ID - **`date_scheduled`** - **Type**: `Timestamp` - **Description**: date scheduled - **`peppolsend_selected`** - **Type**: `Boolean` - **Description**: Peppol Send ### Extra Filters - **`securesend_status`** - **Type**: `String` - **Description**: One of ['draft', 'not_selected', 'cancelled', 'viewed', 'not_viewed'] - **`sendbypost_status`** - **Type**: `String` - **Description**: One of ['draft', 'not_selected', 'cancelled', 'can_cancel', 'preparing', 'mailed', 'info_not_available'] - **`send_to_clientinbox_status`** - **Type**: `String` - **Description**: One of ['draft', 'not_selected', 'cancelled', 'viewed', 'not_viewed'] - **`peppolsend_status`** - **Type**: `String` - **Description**: One of ['draft', 'not_selected', 'sent'] ## Sending Order Item ### Fields - **`url`** `Read-Only` - **Type**: `URL` - **`sending_order`** `Required` - **Type**: `URL` - **Description**: Sending Order URL - **`position`** `Required` - **Type**: `Integer` - **Description**: Position - **`document`** `Expandable` - **Type**: `URL` - **Description**: Document URL - **`filename`** - **Type**: `String` - **Description**: File Name - **`upload_url`** `Read-Only` - **Type**: `URL` - **`async_upload_url`** `Read-Only` - **Type**: `URL` - **Description**: Custom file async upload URL - **`async_upload_tasks_url`** `Read-Only` - **Type**: `URL` - **Description**: Custom file async upload task list URL ## Secure Inbox ### Endpoints - `/api/partner//inbox/inbox/` - Name: Secure Inbox - Methods: GET, OPTIONS Secure Inbox ------- The Secure Inbox is where the following interactions with your Clients can be found. Entries are sorted by `time_received`, with the most recent Documents coming first. ### About the `type` - `accepted_order`: Ordered documents. Quotes or Orderslips where the Client clicked "Sign off" in the pickup screen after being sent with the "Enable Document Accepting For Quotes"/"Enable Document Accepting For Order Slips" setting on. - `confirmed_doc`: Confirmed documents. Acceptance Certificates where the Client clicked "Sign off" in the pickup screen after being sent via Secure Send with "Enable Document Accepting For Acceptance Certs." setting on. - `received_doc`: Client-sent documents. Documents that were sent to you from another MakeLeaps user that one of your users then added to your Secure Inbox. Note on data structure: - `confirmed_doc` and `accepted_order` types: `accepted_order` field is populated and `received_doc` is null. - `received_doc` type: `received_doc` field is populated and `accepted_order` is null. ### Fields - **`mid`** `Read-Only` - **Type**: `String` - **Description**: MakeLeaps ID - **`url`** `Read-Only` - **Type**: `URL` - **`type`** `Required` - **Type**: `One of ['received_doc', 'accepted_order', 'confirmed_doc']` - **Description**: Type - **`accepted_order`** `Required` - **Type**: `Accepted Order` - **Description**: Accepted Order - **`received_doc`** `Required` - **Type**: `Received Document` - **Description**: Received Document - **`time_received`** - **Type**: `Timestamp` - **Description**: Time Received - **`time_read`** - **Type**: `Timestamp` - **Description**: Time Read ### Extra Filters - **`total_from`** - **Type**: `Number` - **`total_to`** - **Type**: `Number` - **`issued_date_from`** - **Type**: `Date` - **`issued_date_to`** - **Type**: `Date` - **`sender_name`** - **Type**: `String` - **`is_unconverted`** - **Type**: `Boolean` ## Received Document ### Fields - **`mid`** `Read-Only` - **Type**: `String` - **Description**: MakeLeaps ID - **`url`** `Read-Only` - **Type**: `URL` - **`document_data`** - **Type**: `Visible Document Data` - **Description**: Visible Document Data - **`vendor_name`** `Read-Only` - **Type**: `String` - **Description**: Client Name - **`display_name`** `Read-Only` - **Type**: `String` - **Description**: Display Name - **`pdf_content_url`** `Read-Only` - **Type**: `URL` - **`generated_document_set`** `Required` - **Type**: `Array of Document` - **Description**: Generated Documents - **`received_by`** `Required` `Expandable` - **Type**: `URL` - **Description**: Employee that added to Secure Inbox ## Accepted Order ### Fields - **`mid`** `Read-Only` - **Type**: `String` - **Description**: MakeLeaps ID - **`url`** `Read-Only` - **Type**: `URL` - **`time_accepted`** `Required` - **Type**: `Timestamp` - **Description**: Time Accepted - **`client`** `Read-Only` - **Type**: `Client` - **`document`** `Required` `Expandable` - **Type**: `URL` - **Description**: Document - **`document_data`** `Required` - **Type**: `JSON Object` - **Description**: Visible Document Data - **`is_paid`** `Read-Only` - **Type**: `Boolean` - **Description**: Paid - **`signatory`** - **Type**: `String` - **Description**: Signer - **`note`** - **Type**: `String` - **Description**: Note - **`generated_document_set`** `Read-Only` - **Type**: `Array of Document` - **Description**: Generated Documents - **`display_name`** `Read-Only` - **Type**: `String` - **Description**: Display Name - **`document_was_edited`** `Read-Only` - **Type**: `Boolean` - **Description**: Document was modified - **`pickup_authorization_mid`** `Read-Only` - **Type**: `String` - **Description**: MakeLeaps ID - **`clientinbox_item_mid`** `Read-Only` - **Type**: `String` - **Description**: MakeLeaps ID - **`date`** `Read-Only` - **Type**: `Date` - **Description**: Date