Quickstart: generate your first PDF
The goal of this quickstart is one successful PDF. Use the included DOCX template, send matching JSON, and save the response as generated.pdf.
1. Create an accountโ
Create a Pritset account, or sign in. New accounts include $15 credit, enough for 5,000 successful PDF generations. No card is required.
2. Obtain credentialsโ
In the portal, open Profile โ Security and copy your Access token and User secret. Keep both private. Pritset sends the access token directly in Authorization and the secret in X-Secret; do not add a Bearer prefix.
3. Upload a DOCX templateโ
Download the sample template. In the portal, open Templates, select +, upload the file, and copy its Id. Use that value as YOUR_TEMPLATE_ID.
The template expects title, description, and an advantages array. See template syntax when you are ready to add more variables.
4. Send data and generate the PDFโ
Replace every YOUR_... value below. The request saves the finished file as generated.pdf.
- cURL
- Node.js
- Python
- PHP
- Go
- .NET
- Java
curl --request POST "https://api.pritset.com/api/template/process/direct/YOUR_TEMPLATE_ID" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--form 'data={"title":"Hello Pritset","description":"Your first PDF generated from a DOCX template.","advantages":[{"title":"Editable templates","description":"Keep layouts in Word."}]}' \
--output generated.pdf \
--write-out "\nHTTP %{http_code} %{content_type}\n"
npm install @pritset/[email protected]
import { PritsetClient } from "@pritset/sdk";
const client = new PritsetClient({
accessToken: process.env.PRITSET_ACCESS_TOKEN!,
secret: process.env.PRITSET_SECRET!,
});
const pdf = await client.documents.generate("YOUR_TEMPLATE_ID", {
title: "Hello Pritset",
description: "Your first PDF generated from a DOCX template.",
advantages: [{ title: "Editable templates", description: "Keep layouts in Word." }],
});
await pdf.saveToFile("generated.pdf");
python -m pip install pritset==0.1.5
import os
from pritset import PritsetClient
with PritsetClient(
access_token=os.environ["PRITSET_ACCESS_TOKEN"],
secret=os.environ["PRITSET_SECRET"],
) as client:
pdf = client.documents.generate("YOUR_TEMPLATE_ID", {
"title": "Hello Pritset",
"description": "Your first PDF generated from a DOCX template.",
"advantages": [{"title": "Editable templates", "description": "Keep layouts in Word."}],
})
pdf.save_to_file("generated.pdf")
composer require pritset/pritset-php:0.1.5
<?php
use Pritset\PritsetClient;
$client = new PritsetClient(
accessToken: $_ENV['PRITSET_ACCESS_TOKEN'],
secret: $_ENV['PRITSET_SECRET'],
);
$pdf = $client->documents()->generate('YOUR_TEMPLATE_ID', [
'title' => 'Hello Pritset',
'description' => 'Your first PDF generated from a DOCX template.',
'advantages' => [['title' => 'Editable templates', 'description' => 'Keep layouts in Word.']],
]);
$pdf->saveToFile(__DIR__ . '/generated.pdf');
go get github.com/pritset/[email protected]
client, err := pritset.NewClient(os.Getenv("PRITSET_ACCESS_TOKEN"), os.Getenv("PRITSET_SECRET"))
if err != nil { log.Fatal(err) }
response, err := client.Documents().Generate(context.Background(), "YOUR_TEMPLATE_ID", map[string]any{
"title": "Hello Pritset",
"description": "Your first PDF generated from a DOCX template.",
"advantages": []map[string]string{
{
"title": "Editable templates",
"description": "Keep layouts in Word.",
},
},
})
if err != nil { log.Fatal(err) }
defer response.Body.Close()
output, _ := os.Create("generated.pdf")
defer output.Close()
_, err = io.Copy(output, response.Body)
dotnet add package Pritset --version 0.1.5
using Pritset;
using var client = new PritsetClient(
Environment.GetEnvironmentVariable("PRITSET_ACCESS_TOKEN")!,
Environment.GetEnvironmentVariable("PRITSET_SECRET")!);
using BinaryResponse pdf = await client.Documents.GenerateAsync("YOUR_TEMPLATE_ID", new {
title = "Hello Pritset",
description = "Your first PDF generated from a DOCX template.",
advantages = new[] {
new { title = "Editable templates", description = "Keep layouts in Word." },
},
});
await pdf.SaveToFileAsync("generated.pdf");
<dependency>
<groupId>com.pritset</groupId>
<artifactId>pritset-java</artifactId>
<version>0.1.5</version>
</dependency>
import com.pritset.sdk.BinaryResponse;
import com.pritset.sdk.PritsetClient;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
PritsetClient client = PritsetClient.builder(
System.getenv("PRITSET_ACCESS_TOKEN"), System.getenv("PRITSET_SECRET")).build();
try (BinaryResponse pdf = client.documents().generate("YOUR_TEMPLATE_ID", Map.of(
"title", "Hello Pritset",
"description", "Your first PDF generated from a DOCX template.",
"advantages", List.of(Map.of(
"title", "Editable templates",
"description", "Keep layouts in Word.")))) {
pdf.save(Path.of("generated.pdf"));
}
5. What success looks likeโ
- The request returns
HTTP 200. - The response content type is
application/pdf. - The generated document contains the supplied title, description, and advantages.
The cURL command and every SDK example save the response as generated.pdf. Open that file with a PDF viewer to check the result.
Next stepsโ
- Add template variables
- Generate asynchronously with a webhook
- View the API reference
- Open an SDK guide
If the first request failsโ
- 401: copy the access token and secret again from the portal; do not add
Bearer. - 404: copy the template ID from the Templates table.
- 400: make the JSON match the fields in your DOCX template.
For status codes, validation behavior, and retry guidance, see API errors. Advanced template management and webhook details remain in the linked API reference.