Official, runnable examples for salary benchmarks and gross-to-net salary calculations with SalaryAPI.
The repository uses only standard runtime features. The JavaScript and Python examples need no third-party packages.
| Use case | Endpoint | Documentation |
|---|---|---|
| Salary benchmarks | POST /api/v1/salary-benchmarks | Salary benchmark API |
| Gross-to-net calculation | POST /api/v1/net-salary | Net salary API |
The complete machine-readable contract is available in the OpenAPI 3.1 specification.
You can also explore the requests in the public SalaryAPI Postman collection.
- A SalaryAPI account with API access or an active API trial
- A SalaryAPI key from the developer dashboard
- One of: cURL, Node.js 18 or newer, or Python 3.10 or newer
See the current SalaryAPI plans for access and usage limits.
Keep the key outside the source code. Never commit it to Git.
macOS or Linux:
export SALARYAPI_KEY="replace_with_your_api_key"PowerShell:
$env:SALARYAPI_KEY="replace_with_your_api_key"node examples/javascript/salary-benchmark.mjs
node examples/javascript/net-salary.mjspython examples/python/salary_benchmark.py
python examples/python/net_salary.pysh examples/curl/salary-benchmark.sh
sh examples/curl/net-salary.shEach example prints the JSON response and exits with a nonzero status when the request fails.
The check validates JavaScript syntax and confirms that the public OpenAPI contract still contains the endpoints and required fields used here.
npm run checkPython and shell syntax can be checked with:
python -m py_compile examples/python/_client.py examples/python/salary_benchmark.py examples/python/net_salary.py
bash -n examples/curl/salary-benchmark.sh examples/curl/net-salary.sh- Read the API key from
SALARYAPI_KEY - Do not put a real key in
.env.example, source files, issues, or logs - Rotate a key from the SalaryAPI developer dashboard if it is exposed
- Use the API from a trusted backend when an application would otherwise expose the key to a browser or mobile client
The examples are available under the MIT License.
