Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

flex-api (Python)

Client for the Flex on the Job tenant API. Standard library only, Python 3.9+.

from flex_api import FlexClient, FlexApiError, SANDBOX_URL

flex = FlexClient(api_key="flx_live_...")          # Settings -> Integrations -> API Keys
# flex = FlexClient("flx_live_YLJG6oxA6hOiJTT7ziyAOFs8nJAJfbRE", base_url=SANDBOX_URL)  # public read-only demo

for item in flex.paginate("/api/v1/items", search="filter"):
    print(item["name"], item["onHand"])

# Writes get an Idempotency-Key automatically (kept across retries).
flex.post("/api/v1/items/stock/batch", {"operations": [
    {"action": "Adjust", "itemId": 12, "locationId": 3, "delta": -2, "reason": "Cycle count"},
    {"action": "Move", "itemId": 12, "fromLocationId": 3, "toLocationId": 4, "quantity": 1},
]})

try:
    flex.post("/api/v1/purchase-orders", {"receivingLocationId": 1, "lines": [{"itemId": 999, "quantityOrdered": 1}]})
except FlexApiError as e:
    print(e.status, e.detail, e.errors)   # 422 ... {'lines[0].itemId': [...]}

What the client does for you:

  • Authorization: Bearer on every request.
  • An Idempotency-Key on every POST/PUT/PATCH/DELETE (pass idempotency_key= to choose your own), reused if the request is retried, so a retry is never applied twice.
  • Retries 429 and 503 (default 3 times), waiting Retry-After (seconds or an HTTP date), and a 409 "still being processed" while an earlier attempt with the same key is running.
  • flex.last_response_headers holds the last response's headers: send its etag back as if_match= on put() / patch() to refuse an update if the record changed in between (412).
  • paginate(path, **query) follows nextCursor across pages.
  • Errors raise FlexApiError with the RFC 7807 problem: status, detail, and errors per field.

Paths, parameters and bodies are exactly those of the OpenAPI document at https://app.flexonthejob.com/openapi/v1.json (browsable at /docs). Tests: python -m unittest discover -s tests.

Examples in examples/: cycle_count.py, invoice_completed_jobs.py (--finalize also marks the drafts sent), receive_delivery.py and reorder_low_stock.py. They talk to the sandbox unless you set FLEX_BASE_URL=https://app.flexonthejob.com. The last three preview their change and write only after --apply, --yes or an interactive yes. The Flex MCP server (/mcp) offers the same tasks as prompts (cycle_count, invoice_completed_jobs, receive_delivery, reorder_below_minimum).

License

Proprietary — Copyright (c) 2026 Flex Services, LLC. All rights reserved. Licensed for use in your applications to access the Flex on the Job API; you may not copy, modify, redistribute, or reverse-engineer it. See the LICENSE file for the full terms.

Release files for flex-api 1.0.0b35

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flex-api 1.0.0b35
File Size Uploaded
flex_api-1.0.0b35.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flex-api 1.0.0b35
File Interpreter ABI Platform
flex_api-1.0.0b35-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / flex_api-1.0.0b35.tar.gz

Download URL flex_api-1.0.0b35.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5f114c47ee2ff878150a5cd91d0e4a8a47d8bc691a3f995e91cf512cb0a06bd9
BLAKE2b-256 checksum
How to use checksums
0c916deae54950c45db644cc009d455d51781bc0c497f9ede9ff86717fcfe67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / flex_api-1.0.0b35-py3-none-any.whl

Download URL flex_api-1.0.0b35-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df068e6d6b0708d81c5476e9ca8a9c7d4a020c973fa9014e9232dcd9bf40ba14
BLAKE2b-256 checksum
How to use checksums
f990025b95593736225c6ffe9f8cc89be71e1ad0c128ac0daf556ed8b369ad39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

1.0.0b35 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page