### List Letters with PHP Source: https://docs.mysendingbox.fr/ This PHP example demonstrates how to fetch all letters using the Seeuletter SDK. Ensure you have installed the SDK via Composer. ```php letters()->all(); print_r($letters); ?> ``` -------------------------------- ### GET / Source: https://docs.mysendingbox.fr/ Ping the API to verify connectivity. ```APIDOC ## GET https://api.mysendingbox.fr/ ### Description Ping the API to check if the service is reachable. ### Method GET ### Endpoint https://api.mysendingbox.fr/ ``` -------------------------------- ### Initialize Node.js Client Source: https://docs.mysendingbox.fr/ Initialize the Seeuletter client in Node.js with your API key. Ensure you have the `seeuletter` package installed. ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') ``` -------------------------------- ### Create a new account via API Source: https://docs.mysendingbox.fr/ Examples for creating a new account using cURL, Node.js, PHP, and Ruby. ```bash curl -X POST "https://api.mysendingbox.fr/accounts" \ -u "test_12345678901234567890:" \ -d '{ "email": "email@domain.com", "name": "Account Name", "phone": "0102030405", "webhook_url": "https://webhook_url_of_the_account.com", "company_name": "Company Name", "address_line1": "Address Line 1", "address_line2": "Address Line 2", "address_postalcode": "Postal Code", "address_city": "City", "address_country": "country", "siren": "SIREN", "cancellation_window": 60 }' --header "Content-Type: application/json" ``` ```javascript // Requirement : Package seeuletter version >= 1.5.0 var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.accounts.create({ "email": "email@domain.com", "name": "Account Name", "phone": "0102030405", "webhook_url": "https://webhook_url_of_the_account.com", "company_name": "Company Name", "address_line1": "Address Line 1", "address_line2": "Address Line 2", "address_postalcode": "Postal Code", "address_city": "City", "address_country": "country", "siren": "SIREN", "cancellation_window": 60 }) .then(function (account) { console.log('The Seeuletter API Account responded : ', account) }) .catch(function (err) { console.log('Error message : ', err.message) console.log('Error status_code : ', err.status_code) }) ``` ```php = 1.2.0 require 'vendor/autoload.php'; $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $account_response = $seeuletter->accounts()->create(array( "email" => "email@domain.com", "name" => "Account Name", "phone" => "0102030405", "webhook_url" => "https://webhook_url_of_the_account.com", "company_name" => "Company Name", "address_line1" => "Address Line 1", "address_line2": => "Address Line 2", "address_postalcode"=> "Postal Code", "address_city" => "City", "address_country" => "country", "siren" => "SIREN", "cancellation_window" => 60 )); print_r($account_response); ?> ``` ```ruby # Requirement : Package seeuletter version >= 1.4.0 require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') puts seeuletter.accounts.create( email: "email@domain.com", name: "Account Name", phone: "0102030405", webhook_url: "https://webhook_url_of_the_account.com", company_name: "Company Name", address_line1: "Address Line 1", address_line2: "Address Line 2", address_postalcode: "Postal Code", address_city: "City", address_country: "country", siren: "SIREN", cancellation_window: 60 ) ``` -------------------------------- ### Send HTML Letter with Node.js Source: https://docs.mysendingbox.fr/ This Node.js example uses the 'seeuletter' library to create and send a letter with HTML content. Ensure the library is installed and your API key is provided. ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.letters.create({ "description": "Demo Letter 1", "color" : "color", "postage_type" : "prioritaire", "postage_speed" : "D1", "to": { "name": "SEEULETTER", "address_line1": "30 rue de la république", "address_city": "Paris", "address_postalcode": "75015", "address_country": "France" }, "source_file": "Lettre HTML for {{name}}<\/html>", "source_file_type": "html", "variables" : { "name" : "Seeuletter" } }, function(err, response){ if(err) console.log('err : ', err) console.log('response : ', response) }) ``` -------------------------------- ### Retrieve All Invoices Source: https://docs.mysendingbox.fr/ Examples for listing invoices using various programming languages and the REST API. ```bash curl -X GET "https://api.mysendingbox.fr/invoices" \ -u "test_12345678901234567890:" ``` ```javascript // Requirement : Package seeuletter version >= 1.5.0 var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.invoices.list({ // Example filters status: "paid", date_start: "2020-01-01", }) .then(function (response) { console.log('[List] The Seeuletter API Invoices responded : ', response) }) .catch(function (err) { console.log('[List] Error message : ', err.message) console.log('[List] Error status_code : ', err.status_code) }) ``` ```php = 1.2.0 $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $invoices_list = $seeuletter->invoices()->all(array( 'status' => "paid", 'date_start' => "2020-01-01", )); echo '[List] The Seeuletter API Invoices responded : '; print_r($invoices_list); ?> ``` ```ruby # Requirement : Package seeuletter version >= 1.4.0 require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') list_response = seeuletter.invoices.list( status: "paid", date_start: "2020-01-01" ) puts "The Seeuletter API Invoices responded : #{list_response}" ``` -------------------------------- ### Create Account with Python SDK Source: https://docs.mysendingbox.fr/ Use the Python SDK to create a new account. Ensure you have the `seeuletter` package installed and your API key configured. The `create` method returns an account object. ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' example_account = seeuletter.Account.create( email="email@domain.com", name="Account Name", phone="0102030405", webhook_url="https://webhook_url_of_the_account.com", company_name="Company Name", address_line1="Address Line 1", address_line2="Address Line 2", address_postalcode="Postal Code", address_city="City", address_country="country", siren="SIREN", cancellation_window=60 ) print example_account ``` -------------------------------- ### API Authentication Example Source: https://docs.mysendingbox.fr/ Demonstrates how to authenticate with the MySendingBox API using a curl command. Ensure you replace 'BAD_API_KEY' with your actual API key. ```shell # With shell, you can just pass the correct username with each request curl "https://api.mysendingbox.fr/" -u "BAD_API_KEY" ``` -------------------------------- ### Retrieve an Invoice via API Source: https://docs.mysendingbox.fr/ Examples for fetching invoice details across various programming languages and cURL. ```bash curl "https://api.mysendingbox.fr/invoices/INVOICE_ID" -u "test_12345678901234567890:" ``` ```javascript // Requirement : Package seeuletter version >= 1.5.0 var seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.invoices.retrieve(INVOICE_ID) .then(function (invoice) { console.log('[Retrieve] The Seeuletter API Invoice responded : ', invoice) }).catch(function (err) { console.log('[Retrieve] Error message : ', err.message) console.log('[Retrieve] Error status_code : ', err.status_code) }) ``` ```php = 1.2.0 $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $invoice = $seeuletter->invoices()->get(INVOICE_ID); echo '[Retrieve] The Seeuletter API Invoices responded : '; print_r($invoice); ?> ``` ```ruby # Requirement : Package seeuletter version >= 1.4.0 require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') find_response = seeuletter.invoices.find(INVOICE_ID) puts "The Seeuletter API Invoice responded : #{find_response}" ``` ```python # Requirement : Package seeuletter version >= 1.2.0 import seeuletter seeuletter.api_key = 'test_12345678901234567890' example_invoice = seeuletter.Invoice.retrieve(INVOICE_ID) print "Invoice Response : " print "\n" print example_invoice print "\n" ``` ```java // Requirement : Package seeuletter version >= 1.2.0 Seeuletter.init("test_12345678901234567890"); SeeuletterResponse responseInvoiceGet = Invoice.retrieve(INVOICE_ID); Invoice invoice = responseInvoiceGet.getResponseBody(); System.out.println(invoice); ``` -------------------------------- ### Initialize Ruby Client Source: https://docs.mysendingbox.fr/ Initialize the Seeuletter client in Ruby. Ensure the `seeuletter` gem is installed and replace `test_12345678901234567890` with your API key. ```ruby require 'seeuletter' eeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') ``` -------------------------------- ### Send electronic letter with local file Source: https://docs.mysendingbox.fr/ Examples for creating an electronic letter using a local file path. ```bash curl -X POST https://api.mysendingbox.fr/letters/electronic \ -u "test_12345678901234567890:" \ -F to.email=no-reply@mysendingbox.fr \ -F to.status=individual \ -F to.first_name=Erlich \ -F to.last_name=Dumas \ -F 'content=Please review the attached documents:' \ -F content_type=text \ -F postage_type=lre \ -F 'source_file=@path/to/your/local/file.pdf' \ -F source_file_type=file ``` ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') var fs = require('fs') Seeuletter.letters.createElectronic({ description: 'Demo Letter Electronic 1', to: { email: 'erlich.dumas@example.com', first_name: 'Erlich', last_name: 'Dumas', status: 'individual' }, postage_type: 'lre', ``` -------------------------------- ### Send HTML Letter with PHP Source: https://docs.mysendingbox.fr/ This PHP example demonstrates sending an HTML letter using the Seeuletter SDK. Make sure to include the autoloader and initialize the Seeuletter client with your API key. ```php 'Seeuletter', 'address_line1' => '30 rue de rivoli', 'address_line2' => '', 'address_city' => 'Paris', 'address_country' => 'France', 'address_postalcode' => '75004' ); $letter = $seeuletter->letters()->create(array( 'to' => $to_address, 'source_file' => 'HELLO', 'description' => 'Test Letters', 'color' => 'bw', 'source_file_type' => 'html', 'postage_type' => 'prioritaire' )); print_r($letter); ?> ``` -------------------------------- ### Postcards response structure Source: https://docs.mysendingbox.fr/ Example of the JSON object returned when successfully listing postcards. ```json { "info": { "count": 2, "requested_at": "2017-10-27T10:18:53.060Z" }, "postcards": [ { "_id": "SkoaUYlA-", "object": "postcard", "to": { "name": "Erlich Bachman", "address_city": "PARIS", "address_line1": "30 rue de Rivoli", "address_country": "France", "address_postalcode": "75004" }, "events": [ { "_id": "S1G1vYgCZ", "updated_at": "2017-10-27T10:13:45.873Z", "created_at": "2017-10-27T10:13:45.873Z", "name": "postcard.created", "category": "postcard", "description": "This postcard has been created.", "postcard": "SkoaUYlA-", "user": "ByDfBFlCW", "webhook_failed": false, "webhook_called": false } ], "mail_provider": "C", "description": "Postcard Démo Doc", "user": "ByDfBFlCW", "mode": "test", "file": "BJ36IFgCb", "created_at": "2017-10-27T10:13:45.868Z", "updated_at": "2017-10-27T10:13:45.868Z" }, { "_id": "HJMprte0b", "object": "postcard", "to": { "name": "Erlich Bachman", "address_city": "PARIS", "address_line1": "30 rue de Rivoli", "address_country": "France", "address_postalcode": "75004" }, "events": [ { "_id": "H1_RrKg0b", "updated_at": "2017-10-27T10:09:20.407Z", "created_at": "2017-10-27T10:09:20.407Z", "name": "postcard.created", "category": "postcard", "description": "This postcard has been created.", "postcard": "HJMprte0b", "user": "ByDfBFlCW", "webhook_failed": false, "webhook_called": false } ], "mail_provider": "C", "updated_at": "2017-10-27T10:09:20.405Z", "created_at": "2017-10-27T10:09:20.405Z", "file": "S1MfpBFl0W", "mode": "test", "user": "ByDfBFlCW", "description": "Postcard Démo Doc" } ] } ``` -------------------------------- ### Send electronic letter with HTML string Source: https://docs.mysendingbox.fr/ Examples for creating an electronic letter using an HTML string as the source file. ```bash curl -X POST "https://api.mysendingbox.fr/letters/electronic" \ -u "test_12345678901234567890:" \ -H 'Content-Type: application/json' \ -d '{ "description": "Demo Letter Electronic 1", "to": { "email": "no-reply@mysendingbox.fr", "status": "individual", "first_name": "Erlich", "last_name": "Dumas" }, "postage_type" : "lre", "content": "Please review the attached documents:", "content_type": "text" , "source_file": "Lettre HTML for {{name}}", "source_file_type": "html", "variables" : { "name" : "MySendingBox" } }' ``` ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.letters.createElectronic({ description: 'Demo Letter Electronic 1', to: { email: 'erlich.dumas@example.com', first_name: 'Erlich', last_name: 'Dumas', status: 'individual' }, postage_type: 'lre', content: 'Please review the attached documents:', content_type: 'text', source_file: 'Hello, {{nom}}', source_file_type: 'html', variables: { nom : 'Seeuletter' } }, function(err, response){ if(err) console.log('err : ', err) console.log('response : ', response) }) ``` ```php 'Erlich', 'last_name' => 'Dumas', 'status' => 'individual', 'email' => 'erlich.dumas@example.com' ); $letter = $seeuletter->letters()->createElectronic(array( 'to' => $to_address_electronic, 'source_file' => 'This is the electronic letter attached document', 'source_file_type' => 'html', 'description' => 'Demo Letter Electronic 1', 'content' => 'Please review the attached documents:', 'content_type' => 'text', 'postage_type' => 'lre' )); print_r($letter); ?> ``` ```ruby require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') puts seeuletter.letters.createElectronic( description: "Demo Letter Electronic 1", to: { email: 'erlich.dumas@example.com', first_name: 'Erlich', last_name: 'Dumas', status: 'individual' }, source_file: 'Hello {{name}}', source_file_type: 'html', content: 'Please review the attached documents:', content_type: 'text', postage_type: 'lre', variables: { name: 'Seeuletter' } ) ``` ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' example_letter = seeuletter.Letter.createElectronic( description='Demo Letter Electronic 1', to_address={ email: 'erlich.dumas@example.com', first_name: 'Erlich', last_name: 'Dumas', status: 'individual' }, content: 'Please review the attached documents:', content_type: 'text', source_file="""Hello {{name}},""", source_file_type="html", variables={ 'name': 'Seeuletter' }, postage_type="lre" ) print example_letter ``` ```java Seeuletter.init("test_12345678901234567890"); final Map variables = new HashMap(); variables.put("name", "Seeuletter"); SeeuletterResponse responseElectronic = new LetterElectronic.RequestBuilder() .setTo( new Address.RequestBuilder() .setFirstName("Erlich") .setLastName("Dumas") .setEmail("erlich.dumas@example.com") .setStatus("individual") ) .setPostageType("lre") .setSourceFile("

Hello {{name}}

", "html") .setDescription("Demo Letter Electronic 1") .setContent("Please review the attached documents:") .setVariables(variables) .create(); LetterElectronic letterElectronic = responseElectronic.getResponseBody(); System.out.println(letterElectronic); ``` -------------------------------- ### Send HTML Letter with Ruby Source: https://docs.mysendingbox.fr/ This Ruby example shows how to send an HTML letter using the Seeuletter gem. Initialize the client with your API key and provide the letter details. ```ruby require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') puts seeuletter.letters.create( description: "Test letter from the Ruby Wrapper", to: { name: 'Erlich', address_line1: '30 rue de rivoli', address_line2: '', address_city: 'Paris', address_country: 'France', address_postalcode: '75004' }, source_file: 'HELLO {{name}}', source_file_type: 'html', postage_type: 'prioritaire', variables: { name: 'Erlich'}, color: 'color' ) ``` -------------------------------- ### List Letters with Python Source: https://docs.mysendingbox.fr/ This Python example retrieves a list of all letters using the Seeuletter library. Set your API key before making the request. ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' list_letters = seeuletter.Letter.list() print list_letters ``` -------------------------------- ### Retrieve a Letter via API Source: https://docs.mysendingbox.fr/ Examples for fetching a specific letter using various programming languages and the cURL command-line tool. ```bash curl "https://api.mysendingbox.fr/letters/HJvwBdY7Z" -u "test_12345678901234567890:" ``` ```javascript var seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.letters.retrieve('LETTER_ID', function(err, response){ if(err) console.log('err : ', err) console.log('response : ', response) }) ``` ```php letters()->get('LETTER_ID'); print_r($letter); ?> ``` ```ruby require 'seeuletter' seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890') puts seeuletter.letters.find('LETTER_ID') ``` ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' get_letter = seeuletter.Letter.retrieve('LETTER_ID') print get_letter ``` ```java Seeuletter.init("test_12345678901234567890"); SeeuletterResponse response = Letter.retrieve("LETTER_ID"); Letter Letter = response.getResponseBody(); System.out.println(Letter); ``` -------------------------------- ### Send HTML Letter with Java Source: https://docs.mysendingbox.fr/ This Java example demonstrates sending an HTML letter using the Seeuletter SDK. Initialize the SDK with your API key and configure the letter details using the RequestBuilder. ```java Seeuletter.init("test_12345678901234567890"); final Map variables = new HashMap(); variables.put("website", "Seeuletter.com"); SeeuletterResponse response = new Letter.RequestBuilder() .setTo( new Address.RequestBuilder() .setName("Seeuletter") .setLine1("25 passage dubail") .setCity("Paris") .setPostalCode("75010") .setCountry("France") ) .setSourceFileType("html") .setSourceFile("

Hello from {{website}}

") .setPostageSpeed("D1") .setDescription("Send with the Java Wrapper") .setBothSides(false) .setPostageType("prioritaire") .setColor("bw") .setVariables(variables) .setPdfMargin(5) .create(); Letter letter = response.getResponseBody(); System.out.println(letter); ``` -------------------------------- ### List Invoices with Python Source: https://docs.mysendingbox.fr/ Use this snippet to list paid invoices starting from a specific date using the Seeuletter Python SDK. Ensure the package version is 1.2.0 or higher and your API key is set. ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' example_list = seeuletter.Invoice.list( status="paid", date_start="2020-01-01" ) print "List Invoice Response : " print "\n" print example_list print "\n" ``` -------------------------------- ### Retrieve all postcards Source: https://docs.mysendingbox.fr/ Use these examples to list all postcards associated with your account. The API requires authentication via your API key. ```bash curl "https://api.mysendingbox.fr/postcards" -u "test_12345678901234567890:" ``` ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.postcards.list(function(err, response){ if(err) console.log('err : ', err) console.log('response : ', response) }) ``` -------------------------------- ### Send HTML Letter with Python Source: https://docs.mysendingbox.fr/ This Python example uses the Seeuletter library to send an HTML letter. Set your API key and provide the necessary details for the letter. ```python import seeuletter seeuletter.api_key = 'test_12345678901234567890' example_letter = seeuletter.Letter.create( description='Test Letter from Python Bindings', to_address={ 'name': 'Erlich', 'address_line1': '30 rue de rivoli', 'address_city': 'Paris', 'address_postalcode': '75004', 'address_country': 'France' }, source_file="""Hello {{name}},""", source_file_type="html", variables={ 'name': 'Erlich' }, postage_type="prioritaire", color="bw" ) print example_letter ``` -------------------------------- ### Postcard Object Structure Source: https://docs.mysendingbox.fr/ This is an example of the JSON response structure when retrieving a postcard. It includes details about the postcard, recipient, events, and associated files. ```json { "_id": "SkoaUYlA-", "object": "postcard", "to": { "name": "Erlich Bachman", "address_city": "PARIS", "address_line1": "30 rue de Rivoli", "address_country": "France", "address_postalcode": "75004" }, "events": [ { "_id": "S1G1vYgCZ", "updated_at": "2017-10-27T10:13:45.873Z", "created_at": "2017-10-27T10:13:45.873Z", "name": "postcard.created", "category": "postcard", "description": "This postcard has been created.", "postcard": "SkoaUYlA-", "user": "ByDfBFlCW", "webhook_failed": false, "webhook_called": false } ], "mail_provider": "C", "description": "Postcard Démo Doc", "user": "ByDfBFlCW", "mode": "test", "file": { "url": "https://lifebot.s3-eu-west-1.amazonaws.com/v4/files/user_ByDfBFlCW/postcard_SkoaUYlA-/file_to_send.pdf?AWSAccessKeyId=AKIAIVWGUB33FDOLMQ4A&Expires=1509100470&Signature=XSt%2FqHiE6VXk%2B001wtDg%2FKHCHec%3D", "_id": "BJ36IFgCb", "updated_at": "2017-10-27T10:13:45.863Z", "created_at": "2017-10-27T10:13:45.863Z", "user": "ByDfBFlCW", "postcard": "SkoaUYlA-", "type": "file_to_send", "path": "v4/files/user_ByDfBFlCW/postcard_SkoaUYlA-/file_to_send.pdf", "page_count": 2 }, "created_at": "2017-10-27T10:13:45.868Z", "updated_at": "2017-10-27T10:13:45.868Z" } ``` -------------------------------- ### List Letters with Node.js Source: https://docs.mysendingbox.fr/ This Node.js snippet uses the 'seeuletter' library to list all letters. Make sure to install the library and provide your API key. ```javascript var Seeuletter = require('seeuletter')('test_12345678901234567890') Seeuletter.letters.list(function(err, response){ if(err) console.log('err : ', err) console.log('response : ', response) }) ``` -------------------------------- ### API Error Response Example Source: https://docs.mysendingbox.fr/ Illustrates the structure of an error response from the MySendingBox API. This object provides details about the error, including a message and status code. ```json { "error": { "message": "This API key is not valid. Please sign up on lettres.mysendingbox.fr to get a valid api key.", "status_code": 401 } } ``` -------------------------------- ### Initialize PHP Client Source: https://docs.mysendingbox.fr/ Initialize the Seeuletter client in PHP using Composer. Replace `test_12345678901234567890` with your API key. ```php ``` -------------------------------- ### Price Response Structure (Deprecated GET /price/letter) Source: https://docs.mysendingbox.fr/ This JSON object shows the structure of the response when using the deprecated GET /price/letter endpoint. It includes postage, service, total price, country, and the pack used. ```json { "postage": 4.65, "service": 1.853, "total": 6.5, "country": "France", "pack": "developer" } ``` -------------------------------- ### Create Account with Java SDK Source: https://docs.mysendingbox.fr/ Utilize the Java SDK to create a new account. Initialize the SDK with your API key. The `create` method on the `Account.RequestBuilder` returns a `SeeuletterResponse` object containing the account details. ```java // Requirement : Package seeuletter version >= 1.2.0 Seeuletter.init("test_12345678901234567890"); SeeuletterResponse response = new Account.RequestBuilder() .setEmail("email@domain.com") .setName("Account Name") .setPhone("0102030405") .setWebhookURL("https://webhook_url_of_the_account.com") .setCompanyName("Company Name") .setAddressLine1("Address Line 1") .setAddressLine2("Address Line 2") .setAddressPostalcode("Postal Code") .setAddressCity("City") .setAddressCountry("country") .setSiren("SIREN") .setCancellationWindow(60) .create(); Account account = response.getResponseBody(); System.out.println(account); ``` -------------------------------- ### Get Letter Price (Deprecated) Source: https://docs.mysendingbox.fr/ This cURL command demonstrates how to retrieve the price of a letter using the deprecated GET /price/letter endpoint. It includes parameters for color, postage type, speed, page count, and country. ```curl curl "https://api.mysendingbox.fr/price/letter" -G -X GET\ -u "test_12345678901234567890:" \ -d color=bw \ -d postage_type=lrar \ -d postage_speed=D1 \ -d page_count=1 \ -d letter_count=1 \ -d both_sides=true \ -d country=France \ ``` -------------------------------- ### GET /invoices/{INVOICE_ID} Source: https://docs.mysendingbox.fr/ This endpoint retrieves a specific invoice by its ID. ```APIDOC ## GET /invoices/{INVOICE_ID} ### Description This endpoint retrieves a specific invoice by its ID. ### Method GET ### Endpoint https://api.mysendingbox.fr/invoices/INVOICE_ID ### Parameters #### Path Parameters - **INVOICE_ID** (string) - Required - The ID of the invoice to retrieve. ### Request Example ```bash curl "https://api.mysendingbox.fr/invoices/INVOICE_ID" \ -u "test_12345678901234567890:" ``` ### Response #### Success Response (200) An Invoice Object is returned. #### Response Example ```json { "_id": "123456789", "invoice_number": 1, "invoice_date": "2021-11-11T00:00:00.000Z", "due_date": "2021-11-11T00:00:00.000Z", "name": "Facture example MySendingBox", "pack": "business", "payment_date": "2021-11-12T12:00:00.000Z", "payment_type": "card", "payment_informations": { "paid": true, "error": null, "error_code": null, "charge": { "created": 1639126681, "receipt_url": "RECEIPT URL", "type": "card" } }, "tva": 20, "country": "France", "invoice_lines": [ { "_id": "61b3169159f851004024a12c", "text": "Affranchissement Prioritaire Industriel - moins de 50g", "tva": 0, "price": 0.63, "total_ht": 11.34 }, { "_id": "61b3169159f851004024a12e", "text": "1ère page - Couleur", "tva": 20, "price": 0.63, "total_ht": 11.34, "total_tva": 2.27, "total_ttc": 13.61 }, { "_id": "61b3169159f851004024a12d", "text": "Pages supplémentaires - Couleur", "tva": 20, "price": 0.3, "total_ht": 10.8, "total_tva": 2.16, "total_ttc": 12.96 } ], "total": { "total_services_ht": 22.14, "total_postages_ht": 11.34, "total_ht": 33.48, "total_tva": 4.428, "total_ttc": 37.908 }, "discount": {}, "status": "paid", "file": { "_id": "rSNSHCtCf3cDNYo-67UaK", "page_count": 1, "name": "Facture_example_MSB", "path": "FILE_PATH", "mimetype": "application/pdf", "extension": "pdf", "type": "invoice", "created_at": "2021-12-10T08:57:56.499Z", "updated_at": "2021-12-10T08:57:56.499Z", "url": "FILE_URL" } } ``` #### Error Response - **unauthorized_invoice** (401): The invoice ID is not attached to the current company API Key, access is forbidden. - **no_invoice** (404): The invoice ID doesn't exist. ``` -------------------------------- ### GET /postcards/{ID} Source: https://docs.mysendingbox.fr/ Retrieves a specific postcard using its ID. ```APIDOC ## GET /postcards/{ID} ### Description Retrieves a specific postcard by its ID. ### Method GET ### Endpoint /postcards/{ID} ### Parameters #### Path Parameters - **ID** (string) - Required - The ID of the postcard to retrieve. ### Response #### Success Response (200) A Postcard Object #### Response Example { "_id": "SkoaUYlA-", "description": "Postcard Demo Doc", "mode": "test", "object": "postcard", "to": { "name": "Erlich Bachman", "address_city": "PARIS", "address_line1": "30 rue de Rivoli", "address_country": "France", "address_postalcode": "75004" }, "mail_provider": "C", "user": "ByDfBFlCW", "file": { "url": "https://lifebot.s3-eu-west-1.amazonaws.com/v4/files/user_ByDfBFlCW/postcard_SkoaUYlA-/file_to_send.pdf?AWSAccessKeyId=AKIAIVWGUB33FDOLMQ4A&Expires=1509100125&Signature=Q0qZWqHXrfHzsldAiAhBskr3pPw%3D", "_id": "BJ36IFgCb", "updated_at": "2017-10-27T10:13:45.863Z", "created_at": "2017-10-27T10:13:45.863Z", "user": "ByDfBFlCW", "postcard": "SkoaUYlA-", "type": "file_to_send", "path": "v4/files/user_ByDfBFlCW/postcard_SkoaUYlA-/file_to_send.pdf", "page_count": 2 }, "events": [ { "_id": "S1G1vYgCZ", "updated_at": "2017-10-27T10:13:45.873Z", "created_at": "2017-10-27T10:13:45.873Z", "name": "postcard.created", "category": "postcard", "description": "This postcard has been created.", "postcard": "SkoaUYlA-", "user": "ByDfBFlCW", "webhook_failed": false, "webhook_called": false } ], "created_at": "2017-10-27T10:13:45.868Z", "updated_at": "2017-10-27T10:13:45.868Z" } ``` -------------------------------- ### GET /invoices Source: https://docs.mysendingbox.fr/ Retrieves a list of invoices based on optional filters and pagination settings. ```APIDOC ## GET /invoices ### Description Retrieves all invoices with optional filtering and pagination. ### Method GET ### Endpoint https://api.mysendingbox.fr/invoices ### Parameters #### Query Parameters - **date_start** (string) - Optional - Filter by invoice_date higher than parameter. - **date_end** (string) - Optional - Filter by invoice_date lower than parameter. - **status** (string) - Optional - Filter based on the current status of invoices. - **order_by** (string) - Optional - Order invoices by property (invoice_date, invoice_number, or total). Default: invoice_date. - **sort_by** (string) - Optional - Sort order (asc or desc). Default: desc. - **page** (integer) - Optional - Page number to return. Default: 1. - **limit** (integer) - Optional - Maximum number of invoices per page. Default: 10. ### Response #### Success Response (200) - **info** (object) - Pagination information (total, limit, page, pages, count, requested_at). - **invoices** (array) - List of Invoice objects. #### Response Example { "info": { "total": 1, "limit": 1, "page": 1, "pages": 1, "count": 1, "requested_at": "2022-01-03T13:52:23.919Z" }, "invoices": [ { "_id": "123456789", "status": "paid" } ] } ``` -------------------------------- ### Create a Letter in PHP Source: https://docs.mysendingbox.fr/ Initializes the Seeuletter client and creates a letter using an associative array for configuration. ```php 'Seeuletter', 'address_line1' => '30 rue de rivoli', 'address_line2' => '', 'address_city' => 'Paris', 'address_country' => 'France', 'address_postalcode' => '75004' ); $letter = $seeuletter->letters()->create(array( 'to' => $to_address, 'source_file' => '@/path/to/your/local/file.pdf', 'description' => 'Test Letters', 'color' => 'bw', 'source_file_type' => 'file', 'postage_type' => 'prioritaire' )); print_r($letter); ?> ```