Prerequisites
Before you start, you'll need:
- An active Connect2Print account
- Access to the admin panel
- Basic understanding of REST APIs
- A development tool like cURL, Postman, or your preferred programming language
Don't have an account yet? Sign up for free
Step 1: Create your first API key
API keys are used to authenticate your requests. Follow these steps to create one:
- Log in to your Connect2Print admin panel
- Navigate to Settings → API Keys
- Click the "Create New API Key" button
- Select Test Mode for development
-
Choose the required permissions (scopes):
orders:read- View orderscustomers:read- View customersproducts:read- View products
- Click "Save" and copy your new API key
Important: Your API key is shown only once. Store it securely and never share it publicly.
Test API keys start with c2p_test_ and Live keys start with c2p_live_.
Step 2: Make your first request
Let's test the API by fetching a list of your orders. Here are examples in different languages:
curl -X GET "https://app1.connect2print.com/api/v1/orders" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"
// Using cURL in PHP $apiKey = 'YOUR_API_KEY'; $ch = curl_init('https://app1.connect2print.com/api/v1/orders'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer {$apiKey}", 'Content-Type: application/json', ], ]); $response = curl_exec($ch); $data = json_decode($response, true); curl_close($ch); print_r($data);
// Using fetch in Node.js const apiKey = 'YOUR_API_KEY'; const response = await fetch('https://app1.connect2print.com/api/v1/orders', { method: 'GET', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' } }); const data = await response.json(); console.log(data);
# Using requests library import requests api_key = 'YOUR_API_KEY' url = 'https://app1.connect2print.com/api/v1/orders' headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json' } response = requests.get(url, headers=headers) data = response.json() print(data)
Step 3: Understanding the response
All API responses follow a consistent structure:
Success response
A successful response contains:
success: true- Request succeededdata- The returned data (array or object)meta- Metadata (pagination, totals, etc.)
{
"success": true,
"data": [
{
"id": 123,
"order_number": "ORD-2024-001",
"status": "processing",
"total": 499.00,
"created_at": "2024-01-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 1,
"total_pages": 1
}
}
Error response
If something goes wrong, you'll get:
success: false- Request failederror.code- Machine-readable error codeerror.message- Human-readable error message
{
"success": false,
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}
Step 4: Handle pagination
List endpoints return data in pages. Use these parameters to navigate:
page- Page number (default: 1)per_page- Items per page (default: 20, max: 100)
Example with pagination
curl -X GET "https://app1.connect2print.com/api/v1/orders?page=2&per_page=50" \ -H "Authorization: Bearer YOUR_API_KEY"
Pagination metadata
The response includes pagination information in the meta object:
"meta": { "current_page": 2, "per_page": 50, "total": 347, "total_pages": 7 }
Next Steps
Now that you've made your first API request, you're ready to explore more:
Need Help?
If you run into any issues or have questions, we're here to help.