Everything about Postcards
Send one or more postcards
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.
Follow our Postcard specification guide to ensure correct sending and postcard template information.
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.
With this option, you can use the /uploads endpoint to upload the document. The /uploads
endpoint returns a URL that can be used in the /post/postcards/send
endpoint.
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 for definitions of HTTP status code responses.
Successful response
{- "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}}"
}
]
}
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Postcard queued for delivery.",
- "data": {
- "total_price": 11,
- "total_count": 1,
- "queued_count": 1,
- "recipients": [
- {
- "user_id": 1,
- "subaccount_id": 13,
- "message_id": "C8CAA97A-905A-4A31-99CB-A92C7BA05A97",
- "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,
- "letter_file_name": "6A559A74-486D-4012-84D7-F3FE11904CB1.pdf",
- "schedule": 1482473172,
- "ip_address": "127.0.0.1",
- "source": ".rest.v3",
- "post_price": 11,
- "priority": 32,
- "status": "SUCCESS",
- "date_added": 1482473172,
- "_return_address": {
- "return_address_id": 0,
- "user_id": 0,
- "address_name": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "address_city": "string",
- "address_state": "string",
- "address_postal_code": "string",
- "address_country": "string"
}, - "_api_username": "johndoe"
}
], - "_currency": {
- "currency_name_short": "AUD",
- "currency_prefix_d": "$",
- "currency_prefix_c": "c",
- "currency_name_long": "Australian Dollars"
}
}
}
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.
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 for definitions of HTTP status code responses.
Successful response
{- "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}}"
}
]
}
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Here is some pricing.",
- "data": {
- "total_price": 11,
- "total_count": 1,
- "queued_count": 1,
- "recipients": [
- {
- "user_id": 1,
- "subaccount_id": 13,
- "message_id": "C8CAA97A-905A-4A31-99CB-A92C7BA05A97",
- "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,
- "letter_file_name": "6A559A74-486D-4012-84D7-F3FE11904CB1.pdf",
- "schedule": 1482473172,
- "ip_address": "127.0.0.1",
- "source": ".rest.v3",
- "post_price": 11,
- "priority": 32,
- "status": "SUCCESS",
- "date_added": 1482473172,
- "_return_address": {
- "return_address_id": 0,
- "user_id": 0,
- "address_name": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "address_city": "string",
- "address_state": "string",
- "address_postal_code": "string",
- "address_country": "string"
}, - "_api_username": "johndoe"
}
], - "_currency": {
- "currency_name_short": "AUD",
- "currency_prefix_d": "$",
- "currency_prefix_c": "c",
- "currency_name_long": "Australian Dollars"
}
}
}
Cancel scheduled postcard
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 for definitions of HTTP status code responses.
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ --request PUT \ 'https://rest.clicksend.com/v3/post/postcards/{message_id}/cancel'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Scheduled postcard has been cancelled.",
- "data": true
}
Retrieve the history of postcards sent or scheduled
Parameter | In | Type | Required | Description |
---|---|---|---|---|
page | query | integer(int32) | false | Page number |
limit | query | integer(int32) | false | Number of records per page |
Refer to Status Codes for definitions of HTTP status code responses.
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ 'https://rest.clicksend.com/v3/post/postcards/history'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Here is your history.",
- "data": {
- "total": 2,
- "per_page": 15,
- "current_page": 1,
- "last_page": 1,
- "next_page_url": null,
- "prev_page_url": null,
- "from": 1,
- "to": 2,
- "data": [
- {
- "user_id": 1,
- "subaccount_id": 13,
- "message_id": "C8CAA97A-905A-4A31-99CB-A92C7BA05A97",
- "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,
- "letter_file_name": "6A559A74-486D-4012-84D7-F3FE11904CB1.pdf",
- "schedule": 1482473172,
- "ip_address": "127.0.0.1",
- "source": ".rest.v3",
- "post_price": 11,
- "priority": 32,
- "status": "SUCCESS",
- "date_added": 1482473172,
- "_return_address": {
- "return_address_id": 0,
- "user_id": 0,
- "address_name": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "address_city": "string",
- "address_state": "string",
- "address_postal_code": "string",
- "address_country": "string"
}, - "_api_username": "johndoe"
}
]
}
}
Export postcard history to a CSV file
Parameter | In | Type | Required | Description |
---|---|---|---|---|
filename | query | string | true | Filename to export to |
Refer to Status Codes for definitions of HTTP status code responses.
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ 'https://rest.clicksend.com/v3/post/postcards/export?filename={filename}'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Download your file here.",
}