Academy / PrintPal API and Automation / Getting Your API Key and First Setup

Getting Your API Key and First Setup

8 min read

Before you can make your first API call, you need two things: an API key and the client library installed. Let's get both set up.

Creating Your API Key

Your API key is like a password that identifies your account when making API requests. Here's how to get one:

  1. Log in to your PrintPal account at https://printpal.io
  2. Navigate to the API Keys page at https://printpal.io/api-keys
  3. Click "Create New API Key"
  4. Give it a descriptive name (like "my-first-key" or "batch-processing")
  5. Copy the key that appears - it will start with pp_live_

Important: Treat your API key like a password. Don't share it publicly, don't commit it to a public code repository, and don't paste it into chat messages. Anyone with your key can use your credits.

Installing the Client Library

Open your terminal and install the library for your language:

Python:

1
pip install printpal

JavaScript/TypeScript:

1
npm install printpal

That's it. The libraries have minimal dependencies and install quickly.

Setting Your API Key

The recommended way to provide your API key is through an environment variable. This keeps it out of your code:

macOS/Linux (terminal):

1
export PRINTPAL_API_KEY="pp_live_your_api_key_here"

Windows (Command Prompt):

1
set PRINTPAL_API_KEY=pp_live_your_api_key_here

Windows (PowerShell):

1
$env:PRINTPAL_API_KEY = "pp_live_your_api_key_here"

When the environment variable is set, the client library will pick it up automatically. You can also pass the key directly in your code (useful for testing, but less secure for production):

Python:

1
2
3
from printpal import PrintPal

client = PrintPal(api_key="pp_live_your_api_key_here")

JavaScript/TypeScript:

1
2
3
import { PrintPal } from 'printpal';

const client = new PrintPal({ apiKey: 'pp_live_your_api_key_here' });

Your First Connection Test

Let's verify everything is working by checking your credit balance and the API health. This is a great "hello world" for the API.

Python:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from printpal import PrintPal

client = PrintPal()

# Check API health (no auth required)
health = client.health_check()
print(f"API status: {health['status']}")

# Check your credit balance
credits = client.get_credits()
print(f"Credits available: {credits.credits}")
print(f"Logged in as: {credits.username}")

JavaScript/TypeScript:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import { PrintPal } from 'printpal';

const client = new PrintPal({ apiKey: process.env.PRINTPAL_API_KEY });

// Check API health
const health = await client.healthCheck();
console.log(`API status: ${health.status}`);

// Check credit balance
const credits = await client.getCredits();
console.log(`Credits available: ${credits.credits}`);
console.log(`Logged in as: ${credits.username}`);

If you see your credit balance and username printed, everything is connected and working. If you get an AuthenticationError, double-check that your API key is correct and that the environment variable is set.

What is the recommended way to provide your API key to the client library?
Hard-code it directly in your source code files
Save it in a public configuration file
Include it in the URL as a query parameter
Set it as an environment variable (PRINTPAL_API_KEY)

Understanding Credits and Pricing

Every 3D generation costs credits. The cost depends on the quality level you choose:

Quality Resolution Credits Estimated Time Texture Support
default 256 cubed 4 ~20 seconds No
high 384 cubed 6 ~30 seconds No
ultra 512 cubed 8 ~60 seconds No
super 768 cubed 20 ~3 minutes No
super_texture 768 cubed 40 ~6 minutes Yes (GLB, OBJ)
superplus 1024 cubed 30 ~4 minutes No
superplus_texture 1024 cubed 50 ~12 minutes Yes (GLB, OBJ)

You can also fetch this information programmatically:

Python:

1
2
3
pricing = client.get_pricing()
for name, tier in pricing.credits.items():
    print(f"{name}: {tier.cost} credits ({tier.description})")

JavaScript/TypeScript:

1
2
3
4
const pricing = await client.getPricing();
for (const [name, tier] of Object.entries(pricing.credits)) {
    console.log(`${name}: ${tier.cost} credits (${tier.description})`);
}

You can purchase additional credits at https://printpal.io/buy-credits.

Rate Limits

The API has rate limits to ensure fair usage:
- 50 requests per minute per API key
- 10,000 requests per day per account
- 5 concurrent generations maximum

For most use cases, these limits are more than sufficient. If you hit a rate limit, the API returns a 429 status code with a Retry-After header, and the client library raises a RateLimitError with the retry delay.

How many credits does a default quality generation cost?
1 credit
2 credits
4 credits
10 credits
Have you finished this lesson?