openapi: 3.0.0
info:
  title: Postcards
  description: Everything about Postcards
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    postcard_recipient:
      type: object
      properties:
        user_id:
          type: integer
          description: The ID of the user.
          example: 1
        subaccount_id:
          type: integer
          description: The ID of the subaccount.
          example: 13
        message_id:
          type: string
          description: The ID of the message.
          example: C8CAA97A-905A-4A31-99CB-A92C7BA05A97
        address_name:
          type: string
          description: The name associated with the address.
          example: John Smith
        address_line_1:
          type: string
          description: The first line of the address.
          example: Address 1
        address_line_2:
          type: string
          description: The second line of the address.
          example: ''
        address_city:
          type: string
          description: The city of the address.
          example: CITY
        address_state:
          type: string
          description: The state of the address.
          example: State
        address_postal_code:
          type: string
          description: The postal code of the address.
          example: '123456'
        address_country:
          type: string
          description: The country code of the address.
          example: AU
        return_address_id:
          type: integer
          description: The ID of the return address.
          example: 1
        letter_file_name:
          type: string
          description: The filename of the letter file.
          example: 6A559A74-486D-4012-84D7-F3FE11904CB1.pdf
        schedule:
          type: integer
          description: The schedule timestamp of the message.
          example: 1482473172
        ip_address:
          type: string
          description: The IP address associated with the message.
          example: 127.0.0.1
        source:
          type: string
          description: The source of the message.
          example: .rest.v3
        post_price:
          type: integer
          description: The price of posting the message.
          example: 11
        priority:
          type: integer
          description: The priority of the message.
          example: 32
        status:
          type: string
          description: The status of the message.
          example: SUCCESS
        date_added:
          type: integer
          description: The timestamp when the message was added.
          example: 1482473172
        _file_url:
          type: string
          description: The URL of the file associated with the message.
          example: >-
            https://rest.clicksend.com/files/6A559A74-486D-4012-84D7-F3FE11904CB1.pdf
        _return_address:
          type: object
          properties:
            return_address_id:
              type: integer
              description: The ID of the return address.
            user_id:
              type: integer
              description: The ID of the user associated with the return address.
            address_name:
              type: string
              description: The name associated with the return address.
            address_line_1:
              type: string
              description: The first line of the return address.
            address_line_2:
              type: string
              description: The second line of the return address.
            address_city:
              type: string
              description: The city of the return address.
            address_state:
              type: string
              description: The state of the return address.
            address_postal_code:
              type: string
              description: The postal code of the return address.
            address_country:
              type: string
              description: The country code of the return address.
        _api_username:
          type: string
          description: The API username associated with the message.
          example: johndoe
    currency:
      type: object
      description: The parameters related to currency.
      properties:
        currency_name_short:
          type: string
          description: >-
            The currency used for the sender in three-letter format (e.g. USD,
            EUR, AUD, NZD, etc).
          example: AUD
        currency_prefix_d:
          type: string
          description: >-
            The symbol used to indicate the currency of the sender (e.g. $ , €,
            etc).
          example: $
        currency_prefix_c:
          type: string
          description: The currency basic unit (e.g. cents).
          example: c
        currency_name_long:
          type: string
          description: The full name of the currency.
          example: Australian Dollars
    send-postcard:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Postcard queued for delivery.
        data:
          type: object
          properties:
            total_price:
              type: number
              example: 11
              description: The total price of the postcard.
            total_count:
              type: integer
              example: 1
              description: The total count of the postcard.
            queued_count:
              type: integer
              example: 1
              description: The count of the queued postcard.
            recipients:
              type: array
              items:
                $ref: '#/components/schemas/postcard_recipient'
            _currency:
              $ref: '#/components/schemas/currency'
    calculate-postcard-price:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Here is some pricing.
        data:
          type: object
          properties:
            total_price:
              type: number
              example: 11
              description: The total price of the postcards.
            total_count:
              type: integer
              example: 1
              description: The total count of the postcards.
            queued_count:
              type: integer
              example: 1
              description: The count of the queued postcards.
            recipients:
              type: array
              items:
                $ref: '#/components/schemas/postcard_recipient'
            _currency:
              $ref: '#/components/schemas/currency'
    cancel-scheduled-postcard:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Scheduled postcard has been cancelled.
        data:
          type: boolean
          example: true
    pagination:
      type: object
      properties:
        total:
          type: integer
          description: The total number of items available for viewing.
          example: 2
        per_page:
          type: integer
          description: >-
            The number of items returned per page. This is specified in the
            limit parameter. You can have 100 items at maximum, and 15 at
            minimum.
          example: 15
        current_page:
          type: integer
          description: The current page number.
          example: 1
        last_page:
          type: integer
          description: The last page number.
          example: 1
        next_page_url:
          type: string
          nullable: true
          description: >-
            A URL of the next page. It will return **null** if there’s no next
            page.
          example: null
        prev_page_url:
          type: string
          nullable: true
          description: >-
            A URL of the previous page. It will return **null** if there’s no
            previous page.
          example: null
        from:
          type: integer
          description: The number of the first result in the current page.
          example: 1
        to:
          type: integer
          description: The number of the last result in the current page.
          example: 2
    view-postcard-history:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Here is your history.
        data:
          allOf:
            - $ref: '#/components/schemas/pagination'
            - type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '#/components/schemas/postcard_recipient'
    export-postcard-history:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Download your file here.
        data:
          type: object
          properties:
            url:
              type: string
              description: The URL to download the file.
              example: >-
                https://rest.clicksend.com/files/705F80D0-D044-4F85-8617-081988B398E5?filename=myexport.csv
paths:
  /v3/post/postcards/send:
    post:
      summary: Send Postcard
      operationId: send-postcard
      description: >-
        _Send one or more postcards_


        ### **Supported File Types**


        We support PDF, docx, doc, jpg, gif, png, and bmp. Contact us to add
        support for any other file type. If you're using docx, doc, jpg, gif,
        png, or bmp files, you'll need to convert the file first using our
        uploads endpoint with the querystring parameter ?convert=postcard. e.g.
        POST /uploads?convert=postcard. This will return a URL to the converted
        pdf file that can be used in the /post/postcards/send endpoint.


        ### **Postcard Specification Guide**


        Follow our [Postcard specification
        guide](https://help.clicksend.com/article/ysyql7bsr1-postcard-template)
        to ensure correct sending and postcard template information.


        ### **Postcard File Options**


        ### Use existing URL


        With this option, you can use an existing URL to a `pdf` document. For
        example, you might generate the `pdf` on your server.


        When using an existing url make sure that it is publicly accessible as
        it will not work if it is private.


        For `file_urls` field. You can attach at least 1 and max of 2 PDF file
        urls.


        - Supply a single pdf with 2 pages (front and back)

        - Supply 2 urls to seperate PDFs
            

        ### Upload File to Our Server


        With this option, you can use the
        [/uploads](https://developers.clicksend.com/docs/rest/v3/#upload-media-file)
        endpoint to upload the document. The `/uploads` endpoint returns a URL
        that can be used in the `/post/postcards/send` endpoint.


        ### Properties


        | Name | Type | Required | Restrictions | Description |

        | --- | --- | --- | --- | --- |

        | file_urls | \[string\] | true | none | Postcard file URLs |

        | address_name | string | true | none | Name of address |

        | address_line_1 | string | true | none | First line of address |

        | address_line_2 | string | true | none | Second line of address |

        | address_city | string | true | none | City |

        | address_state | string | true | none | State |

        | address_postal_code | string | true | none | Postal code |

        | address_country | string | true | none | Country |

        | return_address_id | integer(int32) | true | none | ID of return
        address to use |

        | schedule | integer(int32) | false | none | When to send letter
        (0/null=now) |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file_urls:
                  type: array
                  items:
                    type: string
                recipients:
                  type: array
                  items:
                    type: object
                    properties:
                      address_name:
                        type: string
                      address_city:
                        type: string
                      address_state:
                        type: string
                      address_postal_code:
                        type: string
                      address_country:
                        type: string
                      address_line_1:
                        type: string
                      return_address_id:
                        type: string
              example:
                file_urls:
                  - '{{url}}'
                recipients:
                  - address_name: test
                    address_city: test
                    address_state: test
                    address_postal_code: '6000'
                    address_country: AU
                    address_line_1: 1 test street
                    return_address_id: '{{addressId}}'
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/send-postcard'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \

                 --header "Content-Type: application/json" \
                 --data-binary "{
                \"file_urls\":[
                     \"https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf\",
                     \"https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf\"
                ],
                \"recipients\":[
                    {
                        \"address_name\":\"John Smith\",
                        \"address_line_1\":\"Address 1\",
                        \"address_line_2\":\"\",
                        \"address_city\":\"City\",
                        \"address_state\":\"State\",
                        \"address_postal_code\":\"123456\",
                        \"address_country\":\"AU\",
                        \"return_address_id\":1,
                        \"custom_string\": \"Custom abc123\"
                    }
                ]
            }" \
            'https://rest.clicksend.com/v3/post/postcards/send'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\PostPostcardApi(new
            GuzzleHttp\Client(),$config);

            $post_recipient = new \ClickSend\Model\PostRecipient();

            $post_recipient->setAddressName("My Home Address");

            $post_recipient->setAddressLine1("Address 1");

            $post_recipient->setAddressLine2("Address 2");

            $post_recipient->setaddressCity("city");

            $post_recipient->setaddressState("state");

            $post_recipient->setAddressPostalCode("code");

            $post_recipient->setAddressCountry("country");

            $post_recipient->setReturnAddressId(1);

            $post_recipient->setSchedule(1577013071);

            $post_postcards = new \ClickSend\Model\PostPostcard(); //
            \ClickSend\Model\PostPostcard | PostPostcard model

            $post_postcards->setFileUrls(["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]);
            $post_postcards->setRecipients([$post_recipient]);

            try {
                $result = $apiInstance->postPostcardsSendPost($post_postcards);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling PostPostcardApi->postPostcardsSendPost: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME, 
                Password = API_KEY  
            };

            var postPostcardApi = new PostPostcardApi(configuration);

            var listOfFileUrls = new List<string>();

            listOfFileUrls.Add("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf");

            listOfFileUrls.Add("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf");

            var listOfRecipients = new List<PostRecipient>();

            listOfRecipients.Add(new PostRecipient(
                addressName: "John Smith",
                addressLine1: "Address 1",
                addressLine2: "Address 2",
                addressCity: "City",
                addressState: "State",
                addressPostalCode: "Postal Code",
                addressCountry: "US",
                returnAddressId:  RETURN_ADDRESS_ID,
                schedule: TimeStamp
            ));

            var response = postPostcardApi.PostPostcardsSendPost(new
            PostPostcard(
                fileUrls:  listOfFileUrls,
                recipients: listOfRecipients
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import java.util.Arrays;
            import java.util.List;
            import ClickSend.Api.PostPostcardApi;
            import ClickSend.Model.PostPostcard;
            import ClickSend.Model.PostRecipient;

            public class send_postcard {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                PostPostcardApi apiInstance = new PostPostcardApi(defaultClient);
                PostRecipient recipient= new PostRecipient(); 
                recipient.addressName("name");
                recipient.addressLine1("line1");
                recipient.addressLine2("line2");
                recipient.addressCity("city");
                recipient.addressState("state");
                recipient.addressPostalCode("code");
                recipient.addressCountry("country");
                recipient.returnAddressId(new Integer(1));
                recipient.schedule(new Integer(1545477071));
                List<PostRecipient> recipientList=Arrays.asList(recipient);
                List<String> fileUrlList = Arrays.asList("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf", 
                  "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf");
                PostPostcard postPostcards = new PostPostcard(); // PostPostcard | PostPostcard model
                postPostcards.fileUrls(fileUrlList);
                postPostcards.recipients(recipientList);
                try {
                    String result = apiInstance.postPostcardsSendPost(postPostcards);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling PostPostcardApi#postPostcardsSendPost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var postcardApi = new api.PostPostcardApi("USERNAME", "API_KEY");


            var recipient = new api.PostRecipient();


            recipient.addressName = "John Smith";

            recipient.addressLine1 = "Address 1";

            recipient.addressLine2 = "";

            recipient.addressCity = "city";

            recipient.addressState = "state";

            recipient.addressPostalCode = "123456";

            recipient.addressCountry = "country";

            recipient.returnAddressId = 1;


            var postPostcards = new api.PostPostcard();


            postPostcards.fileUrls =
            ["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]
            postPostcards.recipients = [recipient]


            postcardApi.postPostcardsSendPost(postPostcards).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::PostPostcardApi.new

            # PostPostcard | PostPostcard model
            post_postcards = ClickSendClient::PostPostcard.new(
              "file_urls": ["file_urls", "file_urls"],
              "recipients": [
                ClickSendClient::PostRecipient.new(
                  "address_name": "address_name",
                  "address_line_1": "address_line_1",
                  "address_line_2": "address_line_2",
                  "address_postal_code": "address_postal_code",
                  "address_city": "address_city",
                  "address_state": "address_state",
                  "address_country": "address_country",
                  "return_address_id": 0,
                  "schedule": 0
                )
              ]
            )

            begin
              # Send one or more postcards
              result = api_instance.post_postcards_send_post(post_postcards)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling PostPostcardApi->post_postcards_send_post: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client import PostRecipient

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.PostPostcardApi(clicksend_client.ApiClient(configuration))


            recipient=PostRecipient(address_name="John Smith",
                                    address_line_1="Address 1",
                                    address_line_2="",
                                    address_city="City",
                                    address_state="State",
                                    address_postal_code="123456",
                                    address_country="AU",
                                    return_address_id=1)
            file_url_list=["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]
            # PostPostcard | PostPostcard model

            post_postcards =
            clicksend_client.PostPostcard(file_urls=file_url_list,recipients=[recipient]) 

            try:
                # Send one or more postcards
                api_response = api_instance.post_postcards_send_post(post_postcards)
                print(api_response)
            except ApiException as e:
                print("Exception when calling PostPostcardApi->post_postcards_send_post: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::PostPostcardApi;

            use WWW::ClickSendClient::Object::PostPostcard;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::PostPostcardApi->new(username =>
            $username, password => $password);


            my %params = (
                'file_urls' => [
                    'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
                    'https://yourdomain.com/pdf/dummy.pdf',
                ],
                'recipients' => [
                    {
                        'return_address_id'   => 0,
                        'schedule'            => 0,
                        'address_postal_code' => '12345',
                        'address_country'     => 'address_country',
                        'address_line_1'      => 'address_line_1',
                        'address_state'       => 'address_state',
                        'address_name'        => 'address_name',
                        'address_line_2'      => 'address_line_2',
                        'address_city'        => 'address_city'
                    }
                ]
            );


            my $post_postcards_obj =
            WWW::ClickSendClient::Object::PostPostcard->new(%params);


            my $json_output = $api->post_postcards_send_post('post_postcards' =>
            $post_postcards_obj);


            print $json_output;
        - lang: objc
          source: >-
            #import "CSPostPostcardApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSPostPostcard *postPostcards = [[CSPostPostcard alloc] init];


            CSPostRecipient *postRecipient = [[CSPostRecipient alloc] init];

            postRecipient.addressName = @"address_name";

            postRecipient.addressLine1 = @"address_line1";

            postRecipient.addressLine2 = @"address_line2";

            postRecipient.addressCity = @"address_city";

            postRecipient.addressState = @"addressState";

            postRecipient.addressPostalCode = @"address_postalcode";

            postRecipient.addressCountry = @"address_country";

            postRecipient.returnAddressId = 0;

            postRecipient.schedule = 0;


            CSPostPostcardApi *postPostcardApiInstance = [[CSPostPostcardApi
            alloc] init];

            [postPostcardApiInstance
            postPostcardsPricePostWithPostPostcards:postPostcards
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            let postRecipient1 = PostRecipient(addressName: "address_name",
                                               addressLine1: "address_line1",
                                               addressLine2: "address_line2",
                                               addressCity: "address_city",
                                               addressState: "address_state",
                                               addressPostalCode: "address_postalcode",
                                               addressCountry: "address_country",
                                               returnAddressId: 1,
                                               schedule: nil)

            let postRecipients = [postRecipient1]

            let postPostcards =  PostPostcard(fileUrls: ["fileUrls"],
            recipients: postRecipients)


            PostPostcardAPI.postPostcardsSendPost(postPostcards: postPostcards)
            { (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
  /v3/post/postcards/price:
    post:
      summary: Calculate Postcard Price
      operationId: calculate-postcard-price
      description: >-
        _Calculate price for sending one or more postcards_


        For `file_urls` field. You can attach at least 1 and max of 2 PDF file
        urls.


        - Supply a single pdf with 2 pages (front and back)

        - Supply 2 urls to seperate PDFs
            

        ### Properties


        | Name | Type | Required | Restrictions | Description |

        | --- | --- | --- | --- | --- |

        | file_urls | \[string\] | true | none | Postcard file URLs |

        | address_name | string | true | none | Name of address |

        | address_line_1 | string | true | none | First line of address |

        | address_line_2 | string | true | none | Second line of address |

        | address_city | string | true | none | City |

        | address_state | string | true | none | State |

        | address_postal_code | string | true | none | Postal code |

        | address_country | string | true | none | Country |

        | return_address_id | integer(int32) | true | none | ID of return
        address to use |

        | schedule | integer(int32) | false | none | When to send letter
        (0/null=now) |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file_urls:
                  type: array
                  items:
                    type: string
                recipients:
                  type: array
                  items:
                    type: object
                    properties:
                      address_name:
                        type: string
                      address_city:
                        type: string
                      address_state:
                        type: string
                      address_postal_code:
                        type: string
                      address_country:
                        type: string
                      address_line_1:
                        type: string
                      return_address_id:
                        type: string
              example:
                file_urls:
                  - '{{url}}'
                recipients:
                  - address_name: test
                    address_city: test
                    address_state: test
                    address_postal_code: '6000'
                    address_country: AU
                    address_line_1: 1 test street
                    return_address_id: '{{addressId}}'
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/calculate-postcard-price'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \

                 --header "Content-Type: application/json" \
                 --data-binary "{
                \"file_urls\":[
                    \"https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf\",
                    \"https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf\"
                ],
                \"recipients\":[
                    {
                        \"address_name\":\"John Smith\",
                        \"address_line_1\":\"Address 1\",
                        \"address_line_2\":\"\",
                        \"address_city\":\"City\",
                        \"address_state\":\"State\",
                        \"address_postal_code\":\"123456\",
                        \"address_country\":\"AU\",
                        \"custom_string\":\"Custom abc123\",
                        \"return_address_id\":1
                    }
                ]
            }" \
            'https://rest.clicksend.com/v3/post/postcards/price'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\PostPostcardApi(new
            GuzzleHttp\Client(),$config);

            $post_recipient = new \ClickSend\Model\PostRecipient();

            $post_recipient->setAddressName("My Home Address");

            $post_recipient->setAddressLine1("Address 1");

            $post_recipient->setAddressLine2("Address 2");

            $post_recipient->setaddressCity("city");

            $post_recipient->setaddressState("state");

            $post_recipient->setAddressPostalCode("code");

            $post_recipient->setAddressCountry("country");

            $post_recipient->setReturnAddressId(1);

            $post_recipient->setSchedule(1577013071);

            $post_postcards = new \ClickSend\Model\PostPostcard(); //
            \ClickSend\Model\PostPostcard | PostPostcard model

            $post_postcards->setFileUrls(["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]);
            $post_postcards->setRecipients([$post_recipient]);


            try {
                $result = $apiInstance->postPostcardsPricePost($post_postcards);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling PostPostcardApi->postPostcardsPricePost: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME, 
                Password = API_KEY  
            };

            var postPostcardApi = new PostPostcardApi(configuration);

            var listOfFileUrls = new List<string>();

            listOfFileUrls.Add("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf");

            listOfFileUrls.Add("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf");

            var listOfRecipients = new List<PostRecipient>();

            listOfRecipients.Add(new PostRecipient(
                addressName: "John Smith",
                addressLine1: "Address 1",
                addressLine2: "Address 2",
                addressCity: "City",
                addressState: "State",
                addressPostalCode: "Postal Code",
                addressCountry: "US",
                returnAddressId:  RETURN_ADDRESS_ID,
                schedule: TimeStamp
            ));

            var response = postPostcardApi.PostPostcardsPricePost(new
            PostPostcard(
                fileUrls:  listOfFileUrls,
                recipients: listOfRecipients
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import java.util.Arrays;
            import java.util.List;
            import ClickSend.Api.PostPostcardApi;
            import ClickSend.Model.PostPostcard;
            import ClickSend.Model.PostRecipient;

            public class calculate_postcard_price {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                PostPostcardApi apiInstance = new PostPostcardApi(defaultClient);
                PostRecipient recipient= new PostRecipient(); 
                recipient.addressName("name");
                recipient.addressLine1("line1");
                recipient.addressLine2("line2");
                recipient.addressCity("city");
                recipient.addressState("state");
                recipient.addressPostalCode("code");
                recipient.addressCountry("country");
                recipient.returnAddressId(new Integer(1));
                recipient.schedule(new Integer(1545477071));
                List<PostRecipient> recipientList=Arrays.asList(recipient);
                List<String> fileUrlList = Arrays.asList("https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf", 
                  "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf");
                // PostPostcard | PostPostcard model
                PostPostcard postPostcards = new PostPostcard(); 
                postPostcards.fileUrls(fileUrlList);
                postPostcards.recipients(recipientList);
                try {
                    String result = apiInstance.postPostcardsPricePost(postPostcards);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling PostPostcardApi#postPostcardsPricePost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var postcardApi = new api.PostPostcardApi("USERNAME", "API_KEY");


            var recipient = new api.PostRecipient();


            recipient.addressName = "John Smith";

            recipient.addressLine1 = "Address 1";

            recipient.addressLine2 = "";

            recipient.addressCity = "city";

            recipient.addressState = "state";

            recipient.addressPostalCode = "123456";

            recipient.addressCountry = "country";

            recipient.returnAddressId = 1;


            var postPostcards = new api.PostPostcard();


            postPostcards.fileUrls =
            ["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]
            postPostcards.recipients = [recipient]


            postcardApi.postPostcardsPricePost(postPostcards).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::PostPostcardApi.new

            # PostPostcard | PostPostcard model
            post_postcards = ClickSendClient::PostPostcard.new(
              "file_urls": [
                "file_urls",
                "file_urls"
              ],
              "recipients": [
                ClickSendClient::PostRecipient.new(
                  "address_name": "address_name",
                  "address_line_1": "address_line_1",
                  "address_line_2": "address_line_2",
                  "address_postal_code": "11111",
                  "address_city": "address_city",
                  "address_state": "address_state",
                  "address_country": "US",
                  "return_address_id": 0,
                  "schedule": 0
                )
              ]
            )

            begin
              # Calculate price for sending one or more postcards
              result = api_instance.post_postcards_price_post(post_postcards)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling PostPostcardApi->post_postcards_price_post: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client import PostRecipient

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.PostPostcardApi(clicksend_client.ApiClient(configuration))

            recipient=PostRecipient(address_name="John Smith",
                                    address_line_1="Address 1",
                                    address_line_2="",
                                    address_city="City",
                                    address_state="State",
                                    address_postal_code="123456",
                                    address_country="AU",
                                    return_address_id=1)
            file_url_list=["https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_front.pdf",
                     "https://s3-ap-southeast-2.amazonaws.com/clicksend-api-downloads/_public/_examples/a5_back.pdf"]
            # PostPostcard | PostPostcard model 

            post_postcards =
            clicksend_client.PostPostcard(file_urls=file_url_list,recipients=[recipient]) 


            try:
                # Calculate price for sending one or more postcards
                api_response = api_instance.post_postcards_price_post(post_postcards)
                print(api_response)
            except ApiException as e:
                print("Exception when calling PostPostcardApi->post_postcards_price_post: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::PostPostcardApi;

            use WWW::ClickSendClient::Object::PostPostcard;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::PostPostcardApi->new(username =>
            $username, password => $password);


            my %params = (
                'file_urls' => [
                    'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
                    'https://yourdomain.com/pdf/dummy.pdf',
                ],
                'recipients' => [
                    {
                        'return_address_id'   => 0,
                        'schedule'            => 0,
                        'address_postal_code' => '12345',
                        'address_country'     => 'address_country',
                        'address_line_1'      => 'address_line_1',
                        'address_state'       => 'address_state',
                        'address_name'        => 'address_name',
                        'address_line_2'      => 'address_line_2',
                        'address_city'        => 'address_city'
                    }
                ]
            );


            my $post_postcards_obj =
            WWW::ClickSendClient::Object::PostPostcard->new(%params);


            my $json_output = $api->post_postcards_price_post('post_postcards'
            => $post_postcards_obj);


            print $json_output;
        - lang: objc
          source: >-
            #import "CSPostPostcardApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSPostPostcard *postPostcards = [[CSPostPostcard alloc] init];


            CSPostRecipient *postRecipient = [[CSPostRecipient alloc] init];

            postRecipient.addressName = @"address_name";

            postRecipient.addressLine1 = @"address_line1";

            postRecipient.addressLine2 = @"address_line2";

            postRecipient.addressCity = @"address_city";

            postRecipient.addressState = @"address_state";

            postRecipient.addressPostalCode = @"address_postalcode";

            postRecipient.addressCountry = @"address_country";

            postRecipient.returnAddressId = 0;

            postRecipient.schedule = 0;


            CSPostPostcardApi *postPostcardApiInstance = [[CSPostPostcardApi
            alloc] init];

            [postPostcardApiInstance
            postPostcardsPricePostWithPostPostcards:postPostcards
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            let PostRecipient1 = PostRecipient(addressName: "addressName",
                                               addressLine1: "addressLine1",
                                               addressLine2: "addressLine2",
                                               addressCity: "addressCity",
                                               addressState: "addressStete",
                                               addressPostalCode: "addressPostalCode",
                                               addressCountry: "addressCountry",
                                               returnAddressId: 1,
                                               schedule: nil)

            let PostRecipients = [PostRecipient1]


            let postPostcards = PostPostcard(fileUrls: ["fileUrls"], recipients:
            PostRecipients)

            PostPostcardAPI.postPostcardsPricePost(postPostcards:postPostcards)
            { (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
  /v3/post/postcards/{message_id}/cancel:
    put:
      summary: Cancel Scheduled Postcard
      operationId: cancel-scheduled-postcard
      description: >-
        _Cancel scheduled postcard_


        ### Parameters


        | Parameter | In | Type | Required | Description |

        | --- | --- | --- | --- | --- |

        | message_id | query | string | true | Message ID of the scheduled
        postcard that is to be cancelled. |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content: {}
      parameters:
        - name: message_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cancel-scheduled-postcard'
      x-codeSamples:
        - lang: curl
          source: |2-
              curl --include \
                     --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                     --request PUT \

                'https://rest.clicksend.com/v3/post/postcards/{message_id}/cancel'
  /v3/post/postcards/history:
    get:
      summary: View Postcard History
      operationId: view-postcard-history
      description: >-
        _Retrieve the history of postcards sent or scheduled_


        ### Parameters


        | Parameter | In | Type | Required | Description |

        | --- | --- | --- | --- | --- |

        | page | query | integer(int32) | false | [Page number](/#pagination) |

        | limit | query | integer(int32) | false | [Number of records per
        page](/#pagination) |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/view-postcard-history'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/post/postcards/history'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\PostPostcardApi(new
            GuzzleHttp\Client(),$config);

            $page = 1; // int | Page number

            $limit = 10; // int | Number of records per page


            try {
                $result = $apiInstance->postPostcardsHistoryGet($page, $limit);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling PostPostcardApi->postPostcardsHistoryGet: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: |-
            using IO.ClickSend.ClickSend.Api;
            using IO.ClickSend.Client;
            using IO.ClickSend.ClickSend.Model;

            var configuration = new Configuration()
            {
                Username = USERNAME, 
                Password = API_KEY  
            };
            var postPostcardApi = new PostPostcardApi(configuration);
            var response = postPostcardApi.PostPostcardsHistoryGet();
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.PostPostcardApi;

            public class view_postcard_history {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                PostPostcardApi apiInstance = new PostPostcardApi(defaultClient);
                Integer page = 1; // Integer | Page number
                Integer limit = 10; // Integer | Number of records per page
                try {
                    String result = apiInstance.postPostcardsHistoryGet(page, limit);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling PostPostcardApi#postPostcardsHistoryGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var postcardApi = new api.PostPostcardApi("USERNAME", "API_KEY");


            var page = 1;

            var limit = 10;


            postcardApi.postPostcardsHistoryGet(page,
            limit).then(function(response) {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::PostPostcardApi.new

            opts = {
              page: 1, # Integer | Page number
              limit: 10 # Integer | Number of records per page
            }

            begin
              # Retrieve the history of postcards sent or scheduled
              result = api_instance.post_postcards_history_get(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling PostPostcardApi->post_postcards_history_get: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.PostPostcardApi(clicksend_client.ApiClient(configuration))

            page = 1 # int | Page number (optional) (default to 1)

            limit = 10 # int | Number of records per page (optional) (default to
            10)


            try:
                # Retrieve the history of postcards sent or scheduled
                api_response = api_instance.post_postcards_history_get(page=page, limit=limit)
                print(api_response)
            except ApiException as e:
                print("Exception when calling PostPostcardApi->post_postcards_history_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::PostPostcardApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::PostPostcardApi->new(username =>
            $username, password => $password);


            my $json_output = $api->post_postcards_history_get('page'  => 1
            ,'limit' => '5') ;


            print $json_output;
        - lang: objc
          source: >-
            #import "CSPostPostcardApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            NSNumber *page = [[NSNumber alloc] init];

            NSNumber *limit = [[NSNumber alloc] init];


            CSPostPostcardApi *postPostcardApiInstance = [[CSPostPostcardApi
            alloc] init];

            [postPostcardApiInstance postPostcardsHistoryGetWithPage:page
            limit:limit completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }

            PostPostcardAPI.postPostcardsHistoryGet(page: 1, limit: 15) {
            (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
  /v3/post/postcards/history/export:
    get:
      summary: Export Postcard History
      operationId: export-postcard-history
      description: >-
        _Export postcard history to a CSV file_


        ### Parameters


        | Parameter | In | Type | Required | Description |

        | --- | --- | --- | --- | --- |

        | filename | query | string | true | Filename to export to |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/export-postcard-history'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/post/postcards/export?filename={filename}'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\PostPostcardApi(new
            GuzzleHttp\Client(),$config);

            $filename = "filename_example"; // string | Filename to export to


            try {
                $result = $apiInstance->postPostcardsHistoryExportGet($filename);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling PostPostcardApi->postPostcardsHistoryExportGet: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME, 
                Password = API_KEY  
            };

            var postPostcardApi = new PostPostcardApi(configuration);

            var response =
            postPostcardApi.PostPostcardsHistoryExportGet("FileName");
        - lang: Java
          source: |
            package ClickSend;

            import ClickSend.Api.PostPostcardApi;

            public class export_postcard_history {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                PostPostcardApi apiInstance = new PostPostcardApi(defaultClient);
                String filename = "filename_example"; // String | Filename to export to
                try {
                    String result = apiInstance.postPostcardsHistoryExportGet(filename);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling PostPostcardApi#postPostcardsHistoryExportGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var postcardApi = new api.PostPostcardApi("USERNAME", "API_KEY");


            var filename = "filename";


            postcardApi.postPostcardsHistoryExportGet(filename).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::PostPostcardApi.new

            filename = "filename_example.csv" # String | Filename to export to

            begin
              # Export postcard history to a CSV file
              result = api_instance.post_postcards_history_export_get(filename)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling PostPostcardApi->post_postcards_history_export_get: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.PostPostcardApi(clicksend_client.ApiClient(configuration))

            filename = 'filename_example' # str | Filename to export to


            try:
                # Export postcard history to a CSV file
                api_response = api_instance.post_postcards_history_export_get(filename)
                print(api_response)
            except ApiException as e:
                print("Exception when calling PostPostcardApi->post_postcards_history_export_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::PostPostcardApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::PostPostcardApi->new(username =>
            $username, password => $password);


            my $json_output = $api->post_postcards_history_export_get('filename'
            => 'test filename') ;


            print $json_output;
        - lang: objc
          source: >-
            #import "CSPostPostcardApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSPostPostcardApi *postPostcardApiInstance = [[CSPostPostcardApi
            alloc] init];

            [postPostcardApiInstance
            postPostcardsHistoryExportGetWithFilename:@"filename"
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }

            PostPostcardAPI.postPostcardsHistoryExportGet(filename: "filename")
            { (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
