PDF Yo! PDF Generator API Docs
How to Connect
Endpoint https://www.pdfyo.com/api
If you send a Gen where
testing
is not "T" (see below), any
mail
will go to Docsmit's
test site (tracksmit.com), which responds like Docsmit but does not send any mail. It will,
however, emulate mailing and delivery over a short period of time with all emails
and notifications. Please contact
[email protected] for use of tracksmit.com
Authentication
HTTP Basic Authentication. Username is your email address and password is your password. To obtain an account email
[email protected].
API Calls
All Requests and Responses are in JSON.
POST /pdfgen
This will generate a PDF based on (1) HTML and CSS provided and (2) variables that are substituted into {{fields}} or ((fields)) in the HTML. The resulting
file is delivered by one or more of the following methods:
- delivered in the response as JSON,
- emailed, or
- sent to Docsmit to go out as USPS mail.
Request
testing
(optional; default = "T") : If omitted or anything other than "F", then this gen will not count towards the monthly plan, but it will
have markings on it. Also any mailpiece will not actually be sent - it will be sent to Docsmit's testing site
(which you must request separate access to). Note that you MUST set this parameter as "F" to generate non-testing
docs or to have mail sent through Docsmit's production site.
html
: "" This contains the html/css template that will have fields filled and be converted into a PDF.
Example:
"html":"<h1>Here it is</h1><h3>{{here}} too</h3>"
htmlURL
: "" This contains a URL pointer to the html/css template that will have its fields filled and be converted into a PDF.
Example:
"htmlURL":"http://mydomain.com/templates/voucher.html"
fields
: This is an array of variables that will be substituted into {{fields}} or ((fields)) in the html.
The one predefined field is {{date}} (or ((date))) which replies with a date in the format of "January 4, 2017".
Example:
"fields":
{
"field1":"value1",
"field2":"value2",
"field3":"value3"
}
These next 3 parameters specify where the finished PDF will be delivered. They are all optional (though there really should be one, otherwise, why bother?)
JSON
: true by default - the file will be returned as Base64 in JSON (for Zapier)
email
: PDFYo will email the PDF as an attachment to the indicated email address
mail
: This contains the recipient address, the return address, the mailing specs and Docsmit credentials.
You must include either (firstName
and lastName
) or (organization
).
sendType
choices are First Class
, Certified
, Certified
, Return Receipt
Electronic
, Certified, Return Receipt
(usually known as a "Green Card", Priority
and Priority with
Signature
.
envelope
is optional and the choices are Best
, #10
,
Flat
and Priority, Flat Rate Envelope
. If envelope
is omitted or Best
is chosen, then Docsmit will choose the lowest cost
envelope that can hold the number of pages enclosed.
sided
is optional and chooses whether the document is printed single-sided
or double-sided. If sided
is omitted, the default value is 1
.
If hold
is set to 1, then the mailpiece will be created on Docsmit, but
not sent. You will have the opportunity to review the mailpiece on Docsmit.com and
click Send yourself when ready.
Example:
"mail":
{
"firstName":"Recipient's first name",
"lastName":"Recipient's last name",
"organization":"Recipient's organization name",
"address1":"Address Line 1",
"address2":"Address Line 2",
"city":"City",
"state":"Two letter state abbreviation",
"zip":"Zip code or zip+4",
"sendType":"Certified",
"rtnName":"Return address name here",
"rtnOrganization":"Return address organization name",
"rtnAddress1":"Address line 1",
"rtnCity":"City",
"rtnState":"Two letter state abbreviation",
"rtnZip":"Zip code or zip+4"
}
Response in JSON
HTTP response codes:
[Info about the response codes here.]
timedate
: time date stamp of this response in UTC timezone
errors
: an array of any errors
file
: the resulting PDF encoded in Base64.
remaining
: the number of Gens remaining for this month.
If the request parameter
[hidden]
is set then the response is the PDF and there is no JSON. This is useful for testing with postman and the like.
GET /info
Returns account information.
Request
No parameters.
Response
trialEnds
- the date any trial period ends
used
- Gens used this month
remaining
: the number of remaining Gens
GET /health
- (auth not required)
Allows quick confirmation of service health.
Request
No parameters.
Response
GET /authping
- (auth required)
Allows quick confirmation of successful auth
Request
No parameters.
Response