Skip to content

Usage examples

All examples use curl. Put your key in an environment variable first so you don't paste it into every command:

bash
export ITEFY_KEY="itf_live_<id>_<secret>"
export ITEFY_API="https://api.itefy.com"

Health check (no auth)

bash
curl "$ITEFY_API/v1/ping"

Who am I

Confirm your key works and see which account and user it acts as:

bash
curl -H "Authorization: Bearer $ITEFY_KEY" \
  "$ITEFY_API/v1/whoami"

List items

bash
curl -H "Authorization: Bearer $ITEFY_KEY" \
  "$ITEFY_API/v1/items?page=1&per_page=50"
json
{
  "data": [
    { "id": 101, "name": "Cordless drill", "unique_id": "TOOL-001" }
  ],
  "meta": { "page": 1, "per_page": 50, "total": 128 }
}

Get a single item

bash
curl -H "Authorization: Bearer $ITEFY_KEY" \
  "$ITEFY_API/v1/items/101"

Create an item

Send a JSON body with Content-Type: application/json:

bash
curl -X POST \
  -H "Authorization: Bearer $ITEFY_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Impact wrench", "unique_id": "TOOL-002" }' \
  "$ITEFY_API/v1/items"

The new item is returned under data, and the Location header points at its URL.

Change an item's condition

bash
curl -X POST \
  -H "Authorization: Bearer $ITEFY_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "condition": "needs_service", "remarks": "Trigger sticking" }' \
  "$ITEFY_API/v1/items/101/condition"

Handling errors

Non-2xx responses carry a machine-readable error.code:

json
{ "error": { "code": "invalid_api_key", "message": "Invalid or revoked API key.", "status": 401 } }

Branch on error.code (e.g. invalid_api_key, not_found, plan_upgrade_required, rate_limited) rather than the message text.

TIP

The full set of endpoints, parameters and schemas — with a Try it out button — is in the API reference.