Skip to main content

Postman Collection

Test the Huntrecht Platform API using Postman.

Import Collection​

  1. Open Postman
  2. Click Import
  3. Enter the URL: https://api.huntrecht.com/api/openapi.json
  4. Click Import

Environment Setup​

Create a Postman environment with these variables:

VariableValue
base_urlhttps://api.huntrecht.com/api/v1
client_idYour client ID
client_secretYour client secret
access_token(auto-populated)

Authentication Script​

Add this pre-request script to your collection:

const accessToken = pm.environment.get("access_token");
const tokenExpiry = pm.environment.get("token_expiry");

if (!accessToken || Date.now() > tokenExpiry) {
pm.sendRequest({
url: pm.environment.get("base_url") + "/auth/token",
method: "POST",
header: {
"Content-Type": "application/json"
},
body: {
mode: "raw",
raw: JSON.stringify({
grant_type: "client_credentials",
client_id: pm.environment.get("client_id"),
client_secret: pm.environment.get("client_secret")
})
}
}, function (err, response) {
if (!err) {
const data = response.json();
pm.environment.set("access_token", data.access_token);
pm.environment.set("token_expiry", Date.now() + (data.expires_in * 1000));
}
});
}

Example Requests​

Get Orders​

GET {{base_url}}/orders
Authorization: Bearer {{access_token}}

Create Order​

POST {{base_url}}/orders
Authorization: Bearer {{access_token}}
Content-Type: application/json

{
"customer_id": "cust_xyz789",
"line_items": [
{"product_id": "prod_001", "quantity": 1}
],
"payment_terms": "installments",
"installments": 12
}

Get Credit Score​

GET {{base_url}}/credit-risk/score?customer_id=cust_xyz789
Authorization: Bearer {{access_token}}

Download Collection​

Download the Postman collection from the API endpoint.

OpenAPI Spec​

The full OpenAPI 3.0 specification is available at:

https://api.huntrecht.com/api/openapi.json

Import this directly into Postman for automatic request generation.