Executive Summary
PyjamaHR offers API access for enterprise and custom plan customers to automate job creation and management directly from their own systems or career pages. This guide explains how to create jobs via the PyjamaHR API, provides sample API calls, and addresses common integration scenarios, troubleshooting, and best practices—ensuring you can seamlessly sync your job listings with PyjamaHR and your website.
Detailed Overview
What Is the PyjamaHR Job Creation API?
The PyjamaHR Job Creation API allows eligible customers (typically on custom or enterprise plans) to programmatically create, update, and manage job postings within their PyjamaHR account. This is especially useful for organizations that:
Want to automate job posting from their internal HR systems or custom career pages.
Need to maintain a consistent job listing across multiple platforms.
Require advanced customization and integration beyond the standard PyjamaHR UI or iframe embed.
Key Benefits:
- Automation: Eliminate manual job entry and reduce errors.
- Customization: Control the look and feel of your career page while keeping PyjamaHR as your single source of truth.
- Integration: Sync jobs with your website, third-party tools, or workflow automation platforms (e.g., n8n).
When to Use:
- You have a custom-designed careers page and want to push job data directly to PyjamaHR.
- You need to automate job creation as part of a larger HR or recruitment workflow.
- You require API-based integration for advanced use cases (e.g., multi-location job posting, bulk uploads).
Integration with Other PyjamaHR Features:
- Jobs created via API are managed just like those created in the UI.
- You can control publication to the PyjamaHR Careers Page and third-party job boards.
- Candidate applications can be routed to jobs created via API.
Step-by-Step Guide: Creating Jobs via the PyjamaHR API
Prerequisites
API Access: Only available on custom/enterprise plans. Confirm with your PyjamaHR account manager.
API Token: Obtain your unique API token from PyjamaHR support or your admin dashboard.
API Documentation: PyjamaHR API Docs
Technical Resources: Developer access to your website/backend.
1. Obtain Your API Token
Contact PyjamaHR support or your account manager to enable API access.
You will receive a unique API token (example:
81ee3eba0ddabf93b7cf91727ee929db4194fa44
).Security Tip: Keep your token confidential. Never expose it in client-side (browser) code.
2. Review the API Documentation
Access the PyjamaHR API documentation.
Focus on the POST /jobs endpoint for job creation.
Review required and optional fields (e.g., job title, location, description, publication status).
3. Prepare Your API Request
Endpoint:
POST https://api.pyjamahr.com/v1/jobs
(Replace with the actual endpoint from the documentation if different.)
Headers:
Authorization: Bearer <YOUR_API_TOKEN> Content-Type: application/json
Sample Request Body:
{ "title": "Senior Data Analyst", "location": "Bangkok, Thailand", "description": "We are looking for a Senior Data Analyst to join our team...", "department": "Analytics", "employment_type": "Full-time", "is_published": true, "application_redirect_url": "https://yourcompany.com/careers/senior-data-analyst" }
Key Fields:
- title
(string): Job title.
- location
(string): City, Country (e.g., "Bangkok, Thailand").
- description
(string): Full job description (HTML supported).
- department
(string): Department name.
- employment_type
(string): Full-time, Part-time, etc.
- is_published
(boolean): Whether the job is live.
- application_redirect_url
(string, optional): Redirect candidates to your own application form.
4. Make the API Call
Example using cURL:
curl -X POST "https://api.pyjamahr.com/v1/jobs" \ -H "Authorization: Bearer 81ee3eba0ddabf93b7cf91727ee929db4194fa44" \ -H "Content-Type: application/json" \ -d '{ "title": "Senior Data Analyst", "location": "Bangkok, Thailand", "description": "We are looking for a Senior Data Analyst to join our team...", "department": "Analytics", "employment_type": "Full-time", "is_published": true, "application_redirect_url": "https://yourcompany.com/careers/senior-data-analyst" }'
Example using JavaScript (Node.js/axios):
const axios = require('axios');axios.post('https://api.pyjamahr.com/v1/jobs', { title: 'Senior Data Analyst', location: 'Bangkok, Thailand', description: 'We are looking for a Senior Data Analyst to join our team...', department: 'Analytics', employment_type: 'Full-time', is_published: true, application_redirect_url: 'https://yourcompany.com/careers/senior-data-analyst' }, { headers: { 'Authorization': 'Bearer 81ee3eba0ddabf93b7cf91727ee929db4194fa44', 'Content-Type': 'application/json' } }) .then(response => console.log(response.data)) .catch(error => console.error(error));
5. Confirm Job Creation in PyjamaHR
Log in to your PyjamaHR dashboard.
Navigate to Jobs.
Verify that your new job appears with the correct title, location, and status.
(Screenshot: Jobs list with newly created job highlighted.)
6. (Optional) Advanced Fields and Customization
Use additional fields as documented (e.g., salary range, custom tags).
Set
is_published
tofalse
to create a draft.Use
application_redirect_url
to send applicants to your own form (common for customers wanting to maintain their own career page UX).
Advanced Usage & Best Practices
Power User Tips
Bulk Job Creation: Use batch API calls to upload multiple jobs at once.
Custom Career Page Integration: Use the API to fetch jobs and display them in your own design, applying custom CSS as needed.
Application Routing: Set
application_redirect_url
to control where candidates apply (PyjamaHR form vs. your own).Version Control: Track job IDs and update jobs via the API to avoid accidental overwrites (see Conversation 2762 for accidental renaming).
Optimization Strategies
Automate with Workflow Tools: Integrate with platforms like n8n or Zapier for end-to-end automation.
Error Handling: Always check API responses for errors and log them for troubleshooting.
Security: Never expose your API token in client-side code. Use server-side calls only.
Do’s and Don’ts
Do:
- Use the API for seamless integration with your website or HRIS.
- Validate all required fields before making API calls.
- Regularly rotate your API token for security.
Don’t:
- Don’t expose your API token in public repositories or browser code (prevents CORS and security issues).
- Don’t overwrite existing jobs unintentionally—always use unique job IDs for updates.
Troubleshooting & Common Issues
Common Issues
1. CORS Errors
- Scenario: Making API calls directly from the browser results in CORS errors.
- Solution: Always make API calls from your backend/server, not from client-side JavaScript.
2. Duplicate or Overwritten Jobs
- Scenario: Editing a job via API accidentally changes another job’s details (see Conversation 2762).
- Solution: Double-check job IDs and payloads before updating. Use unique identifiers.
3. API Access Not Available
- Scenario: API endpoints return unauthorized or forbidden errors.
- Solution: Confirm your plan includes API access. Contact support to enable it.
4. Location Filter Includes Unwanted Countries
- Scenario: Location dropdown includes countries you don’t use.
- Solution: The country list is global and cannot be customized via API. Filter results on your website as needed.
5. Application Routing Not Working
- Scenario: Candidates are not redirected to your own career page.
- Solution: Ensure application_redirect_url
is set correctly in your API call.
When to Contact Support
You need your API token or documentation.
You encounter persistent errors not covered above.
You want to upgrade your plan for API access.
Comprehensive FAQ
1. Who can use the PyjamaHR Job Creation API?
Only customers on custom or enterprise plans with API access enabled.
2. Where do I get my API token?
Contact PyjamaHR support or your account manager.
3. Can I create jobs via API and have candidates apply on my own website?
Yes. Use the application_redirect_url
field to redirect applicants.
4. Can I remove countries from the location filter?
No. The country list is global and cannot be customized.
5. Why am I getting a CORS error?
API calls must be made from your backend/server, not directly from the browser.
6. Can I bulk upload jobs via API?
Yes, use batch calls as documented in the API docs.
7. How do I update or delete a job via API?
Use the appropriate PUT
or DELETE
endpoints as per the API documentation.
8. Can I fetch a list of jobs via API?
Yes, use the GET /jobs
endpoint.
9. What happens if I overwrite a job by mistake?
You may end up with duplicate or incorrect job data. Always verify job IDs and payloads.
10. Can I use the API to customize the look of my job listings?
You can fetch job data and display it in any design on your website.
11. Is there a way to automate candidate flow from my website to PyjamaHR?
You can use the API to create jobs and route applications, but reverse automation (creating jobs in PyjamaHR based on your website postings) is not supported.
12. How do I troubleshoot API errors?
Check the error message, verify your token, and ensure you’re using the correct endpoint and payload.
Related Features & Next Steps
Candidate API: Fetch and manage applications for jobs created via API.
Career Page Integration: Use iframe or API for advanced customization.
Job Board Publishing: Control where jobs are published (PyjamaHR Careers Page, LinkedIn, etc.).
Workflow Automation: Integrate with tools like n8n or Zapier for end-to-end automation.
Recommended Articles:
- Integrating Your Career Page with PyjamaHR
- Fetching Job Listings via API
- Managing Candidate Applications via API
- Customizing the PyjamaHR Careers Page
Still have questions?
Contact PyjamaHR support for API enablement, advanced integration scenarios, or troubleshooting not covered here.
This article is based on real customer conversations and is updated regularly to reflect the latest PyjamaHR capabilities and best practices.