Pensaki API Reference

Contents:

Access url to api https://www.pensaki.com/api

Auth

User authorization

URL:

https://www.pensaki.com/api/auth/

JSON POST Parameters:

Parameter Description
user account username
email account email
api_key account api key, you find key in account settings

Response:

When authorization pass:

Parameter name Description
authorized return true
token unique token for user
username account user name who send request for token
valid till date till this token will be valid

When authorization fails: HTTP 403 Forbidden

See more errors and warnings

Example

Parameter name Value
user johndoe
email johndoe@examplemail.com
api_key xK1mK545ji5FmwFV1f48QMzKwmHDcdjpD

URL:

https://www.pensaki.com/api/auth/

JSON POST:

{
    "user" : "johndoe",
    "email" : "johndoe@examplemail.com",
    "api_key" : "xK1mK545ji5FmwFV1f48QMzKwmHDcdjpD"
}

Response:

{
    "username": "johndoe",
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "valid_till": "2015-07-15 10:53:34.099347",
    "authorized": true
}

Create Post

Create to order product

URL:

https://www.pensaki.com/api/create_post/

JSON POST Parameters:

Parameter Description
token Unique user token
product_slug See product slugs
letter (optional) If you want put whole text without division on specific lines, the text will be automagically formated
<line in letter> See more about products and available lines

Example

Parameter name Value
token 1csfzztWIwkO8BRvQfQPiU
product_slug handwritten-deluxe-card
line-1 I hope you are doing great. A massive big thank-you to
line-2 you both for letting me crash at your place (again) during
line-3 the conference. Your home is so warm, welcoming and
line-4 delightful. Anyone would have felt pampered like I did.
your-name John
ps-line P.S. Please tell my mom I wrote you this thank-you note.
envelope-1 John Doe
envelope-2 Berlin

URL:

https://www.pensaki.com/api/create_post/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "product_slug": "handwritten-deluxe-card",
    "line-1": "I hope you are doing great. A massive big thank-you to",
    "line-2": "you both for letting me crash at your place (again) during",
    "line-3": "the conference. Your home is so warm, welcoming and",
    "line-4": "delightful. Anyone would have felt pampered like I did.",
    "your-name": "John",
    "ps-line": "P.S. Please tell my mom I wrote you this thank-you note.",
    "envelope-1": "John Doe",
    "envelope-2": "Berlin"
}

Response:

{
    "post_id": 779,
    "errors": [],
    "authorized": true,
    "warnings": []
}

Add recipients

Add recipients to order product

URL:

https://www.pensaki.com/api/add_recipients/

JSON POST Parameters:

Parameter Description
token Unique user token
post_id id letter
city City
recipient_salutation Recipient salutation
zip Zip Code
street Street
address Address
country_name Country name
recipient_name (optional) Recipient name

Example

Parameter name Value
token 1csfzztWIwkO8BRvQfQPiU
post_id 779
city Hannover
recipient_salutation Dear Sophie and Mark
zip 60327
street Kleperweg 188
address Smith Ltd
country_name Germany
recipient_name (optional) Sophie Locke

URL:

http://www.pensaki.com/api/add_recipients/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "post_id": "779",
    "city": "Hannover",
    "recipient_salutation": "Dear Sophie and Mark",
    "zip": "60327",
    "street": "Kleperweg 188",
    "address": "Smith Ltd",
    "country_name": "Germany",
    "recipient_name": "Sophie Locke"
}

Response:

{
    "errors": [],
    "success": true,
    "warnings": []
}

Get recipients

Get recipients from order product

URL:

https://www.pensaki.com/api/get_recipients/

JSON POST Parameters:

Parameter Description
token Unique user token
post_id id letter

Example

Parameter name Value
token 1csfzztWIwkO8BRvQfQPiU
post_id 779

URL:

https://www.pensaki.com/api/get_recipients/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "post_id": 779
}

Response:

[
    {
        "recipient_name": "Sophie Locke",
        "street": "Kleperweg 18",
        "address": "Smith Ltd",
        "city": "Hannover",
        "recipient_salutation": "Dear Sophie and Mark",
        "zip": "60327",
        "recipient_id": 1995,
        "country_name": "Germany"
    }
]

Confirm

Confirm order product

URL:

https://www.pensaki.com/api/confirm/

JSON POST Parameters:

Parameter Description
token Unique user token
post_id id letter

Example

Parameter name Value
token 1csfzztWIwkO8BRvQfQPiU
post_id 779

URL:

https://www.pensaki.com/api/confirm/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "post_id": 779
}

Response:

{
  "success": true,
  "errors": [],
  "warnings": []
}

Get items

Get all items from order

URL:

https://www.pensaki.com/api/get_items/

JSON POST Parameters:

Parameter Description
token Unique user token

Example

Parameter name Value
token 1csfzztWIwkO8BRvQfQPiU

URL:

https://www.pensaki.com/api/get_items/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU"
}

Response:

{
    "items": [["Pensaki\u00ae Deluxe Card   ", 779]],
    "errors": [],
    "warnings": []
}

Create order

Confirm order

URL:

https://www.pensaki.com/api/create_order/

JSON POST Parameters:

Parameter name Value
token Unique user token
billing-type Allowed values : p (Private) f (Firma)
name Name
city Berlin
country_code Country code
state State
city City
address Adress
zip_code Zip code

Example

Parameter Description
token 1csfzztWIwkO8BRvQfQPiU
billing-type p
name John Doe
city Berlin
country_code DE
state Germany
city Ingolstad
addresss Flensburger Str 79
zip_code 20147

URL:

https://www.pensaki.com/api/create_order/

JSON POST:

{
    "token": "1csfzztWIwkO8BRvQfQPiU",
    "billing-type": "p",
    "name": "John Doe",
    "city": "Berlin",
    "country_code": "DE",
    "state": "Germany",
    "city": "Ingolstadt",
    "address": "Flensburger Str 79",
    "zip_code": "20147"
}

Response:

{
    "order_id": 3751,
    "errors": [],
    "warnings": []
}

Warnings and Errors

Message Type
There’s not allowed characters in <name> at <number> Error
Field <name> is required Error
Invalid or expired token Error
Field <name> is empty. Do you want leave it empty? Warning
Field <name> too long. Rest of text will be cut Warning
Invalid post id Error
Product does not exist Error
Cart for selected user does not exist Error
Select billing type: private or firma Error
Sequence of capital letters in <name> at <number> Warning
Invalid json POST, please check your query Error

Products

Names and slugs

Product name Product slug
Deluxe Card handwritten-deluxe-card
Postcard pensaki-postcard
Premium Letter handwritten-premium-letter
Premium Note handwritten-premium-note
Short Letter pensaki-short-letter

Available parameters

Deluxe Card

Parameter name Required when parameter letter is filled Max Length
line-1 False 58
line-2 False 58
line-3 False 58
line-4 False 58
envelope-1 True 55
envelope-2 True 55
your-name True 58
ps-line True 62

Postcard

Parameter name Required when parameter letter is filled Max Length
pc-line-1 False 32
pc-line-2 False 32
pc-line-3 False 32
pc-line-4 False 32
pc-line-5 False 32
pc-line-6 False 32
pc-line-7 False 32
pc-line-8 False 32
pc-line-9 False 32

Premium Letter

Parameter name Required when parameter letter is filled Max Length
line-1-letter False 58
line-2-letter False 58
line-3-letter False 58
line-4-letter False 58
line-5 False 58
line-6 False 58
line-7 False 58
line-8 False 58
line-9 False 58
line-10 False 58
line-11 False 58
line-12 False 58
line-13 False 58
line-14 False 58
envelope-1 True 55
envelope-2 True 55
line-1-header True 32
line-2-header True 32
line-3-header True 32
line-4-header True 32

Premium Note

Parameter name Required when parameter letter is filled Max Length
line-1 False 58
line-2 False 58
line-3 False 58
line-4 False 58
envelope-1 True 55
envelope-2 True 55
your-name True 58
ps-line True 62

Short Letter

Parameter name Required when parameter letter is filled Max Length
line-1-letter False 58
line-2-letter False 58
line-3-letter False
line-4-letter False 58
line-5 False 58
line-6 False 58
line-7 False 58
line-12 False 58
line-13 False 58
line-14 False 58
envelope-1 True 55
envelope-2 True 55
line-4-header True 32