Every account, ticket draft, sync operation, and audit log is strictly scoped by cryptographic organization identity.
02
Idempotent Mutations
Deterministic idempotency keys protect draft creation, approvals, and mutations against network retries.
03
Safe Pipeline & Outbox
Multi-layer fail-closed safety gates execute verified dry-run simulations before any live portal action.
Your First Request
Use /api/v1/auth/me to verify an issued API key and inspect its tenant organization, granted scopes, and expiration timestamp.
API Base URL
Current guide origin
Authentication Type
Bearer Service API Key
Payload & Encoding
JSON Β· UTF-8
Rate Limiter
IP & Key Token Bucket
Terminal / cURL Quickstart
# 1. Export your issued tenant API key
export OCC_API_KEY="occ_live_your_api_key_here"
# 2. Verify credentials and permissions
curl --fail-with-body \
/api/v1/auth/me \
-H "Authorization: Bearer $OCC_API_KEY" \
-H "X-Correlation-ID: check-001"
Note: This developer guide only displays public OpenAPI schemas. It never collects, transmits, or logs secrets.
β οΈ Safety Boundary: Fail-Closed Live Gates
Local review approval of a ticket draft is NOT authorization for OCC portal submission. Live ticket creation or final submission requires explicit activation of the global live gate (OCC_LIVE_SUBMIT_ENABLED=true) AND inclusion of the OCC account in IOWA_SUBMIT_AUTHORIZED_ACCOUNT_IDS. Without explicit authorization, the background worker safely executes a verified dry-run simulation and emits an outbox event with a SIM-IA-XXXX confirmation reference.
Zero-Trust Access Control
Authentication & Scopes
All requests to /api/v1/* must include Authorization: Bearer <API_KEY>. Organization identity is derived exclusively from the authenticated key signature stored in the database. Supplying foreign IDs in query strings or body payloads will fail authorization.
Connecting an Existing Account
Verify the key with GET /api/v1/auth/me; inspect active scopes, organization ID, and expiry timestamp.
Inspect the OCC Account with GET /api/v1/occ-accounts/{account_id} requiring occ_accounts:read.
Enforce principle of least privilege: issue sub-clients with only the required scopes (e.g. tickets:read for read-only workers, operations:read for monitoring).
Plaintext secret keys appear only once upon issuance. Never place keys in Git repositories, frontend JavaScript, or unencrypted logs.
Complete Permission Reference
Key Lifecycle Management
When issuing replacement keys with POST /api/v1/api-clients, assign a unique name, valid future UTC expiration, and scopes that do not exceed the issuing client. Rotate keys gracefully: bind the replacement client in your integration before revoking the previous client.
CodeIgniter ERP β Python Trust Boundary
ERP User Access & Delegation
CodeIgniter owns human user accounts, passwords, sessions, login, and ERP company administration. Python owns OCC organizations, accounts, credentials, and access grant delegations. ERP staff identities are not imported into the separate developer signup directory. Developer login and ERP account-scoped access are distinct.
Action
Endpoint
Required Scope
List Account Grants
GET /api/v1/access-grants?account_id=UUID&limit=50&offset=0
access_grants:read
Read Specific Grant
GET /api/v1/access-grants/one-dig/{external_user_id}/{account_id}
access_grants:read
Assign, Update, Revoke
PUT /api/v1/access-grants/one-dig/{external_user_id}/{account_id}
The ERP identifier must be namespaced by its authoritative database: platform:42 or tenant:3:42. Use expected_version: 0 for initial assignment creation. To revoke access while preserving audit history, send is_active: false with the incremented expected version.
Delegated Staff Requests
When an ERP user performs an operation in the workspace, CodeIgniter verifies the user's active session, then sends assertion headers using its trusted backend API credential:
Python intersects the API client scopes with the active assignment capabilities. If the assignment is revoked, the account is disabled, or required capabilities are missing, the request fails closed with 403 Forbidden.
End-to-End Pipeline
Iowa 811 Ticket Automation Workflow
1
Prepare State-Neutral Ticket Draft
Call POST /api/v1/ticket-drafts with state_code: "IA" and an Idempotency-Key header. Includes address, work description, schedule, contact info, and GeoJSON Polygon work areas.
Call POST /api/v1/ticket-drafts/{id}/approvals with {"expected_version": 1}. Draft review transitions lifecycle to approved. Unapproved drafts are strictly prohibited from mutation or submission.
3
Trigger Submission Pipeline (Safe Ingress)
Submit to POST /api/v1/occ-accounts/{account_id}/iowa/ticket-operations. The ingress API evaluates readiness:
Notice Lead Time (Iowa Code Β§ 480.1(5A)): 48 consecutive business hours beginning at 06:00 on the next business day following submission, excluding Saturdays, Sundays, and legal holidays (Iowa Code Β§ 1C.1). Filing notice is not excavation clearance; utility operator marking or positive response is required prior to digging.
Geographic Boundary: Coordinates must reside within Iowa boundary ($[40.375, 43.501] \times [-96.639, -90.140]$).
Validity Duration: Notice remains valid for 25 calendar days beginning on the day the 48-hour period concludes (Iowa Code Β§ 480.4(1)(a)).
Required Fields: County, city/place, street, work type, 10-digit phone, and email.
Returns HTTP 202 Accepted with initial status "queued" and wakes background submit workers via Redis.
4
Worker Execution & Dry-Run Simulation
IowaTicketSubmitWorker leases the job via FOR UPDATE SKIP LOCKED with distributed account lock fencing. When live submission is disabled (default), the worker runs a verified dry-run simulation, generates a deterministic confirmation reference (SIM-IA-XXXX), and publishes an outbox event.
5
Live Portal Traversal & Stored Observations
Inspect stored observations with GET /iowa/stored-tickets or read live ticket details with GET /iowa/tickets/detail?reference=... using a detail reference returned by the adapter and database-backed account permissions.
πΎ Nebraska (NE) Scope
Nebraska 811 Ticket Ingestion & Live Sync Workflow
1
Store Encrypted Nebraska Credentials
Register or connect Nebraska account credentials via POST /api/v1/occ-accounts/connect with state_code: "NE". Credentials are saved encrypted with authenticated encryption (ADR 0002) and never stored in plain text.
2
Inspect Gates & Verify Session
Verify authorization with GET /api/v1/occ-accounts/{account_id}/nebraska/live-read-capabilities. Live portal access requires all four safety gates: OCC_LIVE_MODE_ENABLED=true, NEBRASKA_LIVE_READ_ONLY_ENABLED=true, database live_read_enabled=true permission on the account, and the occ_accounts:live_read API scope. Then call POST /api/v1/occ-accounts/{account_id}/nebraska/verify-login to validate credentials against https://ne.itic.occinc.com.
3
Bounded Ticket List Synchronization
Execute POST /api/v1/occ-accounts/{account_id}/nebraska/tickets/sync with an opaque Idempotency-Key header and tickets:read scope. Each sync reads at most 100 visible first-page tickets and 5 ticket details, then atomically persists state-scoped observations (state_code: "NE", nebraska_first_page, nebraska_ticket_detail). Pagination is not traversed. Previously saved tickets absent from this partial read are retained. Same-key retries return stored results without contacting the portal.
4
Search, Filter & Inspect Stored Nebraska Tickets
Inspect synchronized tickets using GET /api/v1/occ-accounts/{account_id}/nebraska/stored-tickets/table with text search, sorting, and pagination. Access single ticket observations at /stored-tickets/{ticket_id}, review revision histories at /revisions, and audit status events at /status-events. A gated detail read uses /nebraska/tickets/detail?reference=..., with the adapter-provided reference. Historical utility responses do not establish current response status; geometry and missing details are not inferred.
5
Audit Sync Operations & Attempts
Track durable sync operations at GET /api/v1/occ-accounts/{account_id}/nebraska/sync-operations and inspect individual attempt diagnostics at /sync-operations/{operation_id}/attempts with operations:read scope. Attachments, conversations, and damage reports under /nebraska/stored-tickets/{ticket_id} are local records. They are not sent to OCC. Nebraska damage submission and job profile changes are disabled; read permission cannot enable these writes. Job profile snapshots and gated refresh are available, with Nebraska response acceptance still pending.
Enterprise Transactional Delivery
Transactional Outbox & Webhooks
The OCC Platform implements the Transactional Outbox Pattern to guarantee that background events (ticket sync completions, submit simulations, live confirmations) are never lost during network partitions or server restarts.
Cryptographic HMAC-SHA256 Signatures
Every webhook POST request delivered to your CodeIgniter ERP endpoint includes cryptographic signature headers to verify authenticity and prevent replay attacks:
The signature is calculated as: HMAC_SHA256("t={timestamp}.{raw_json_body}", secret_key). Replays outside the 300-second window must be rejected.
CodeIgniter Webhook Receiver Example
PHP 8.x / CodeIgniter 3 or 4 Controller
<?php
namespace App\Controllers;
use CodeIgniter\RESTful\ResourceController;
class OCCWebhookReceiver extends ResourceController
{
public function handle()
{
$rawPayload = $this->request->getBody();
$sigHeader = $this->request->getHeaderLine('X-OCC-Signature');
$secretKey = getenv('OCC_WEBHOOK_SECRET');
// 1. Parse signature header (t={timestamp},v1={hash})
preg_match('/t=(\d+),v1=([a-f0-9]+)/', $sigHeader, $matches);
if (count($matches) !== 3) {
return $this->failUnauthorized('Malformed signature header');
}
$timestamp = (int)$matches[1];
$expectedHash = $matches[2];
// 2. Enforce 300-second replay tolerance window
if (abs(time() - $timestamp) > 300) {
return $this->failUnauthorized('Timestamp outside tolerance window');
}
// 3. Constant-time HMAC-SHA256 signature verification
$signedContent = "t={$timestamp}.{$rawPayload}";
$computedHash = hash_hmac('sha256', $signedContent, $secretKey);
if (!hash_equals($expectedHash, $computedHash)) {
return $this->failUnauthorized('Invalid HMAC signature');
}
// 4. Process event
$event = json_decode($rawPayload, true);
$eventType = $this->request->getHeaderLine('X-OCC-Event');
switch ($eventType) {
case 'iowa.ticket_submit.simulated':
case 'iowa.ticket_submit.submitted':
// Update CodeIgniter ticket record with confirmation reference
break;
case 'iowa.ticket_sync.completed':
// Refresh local ticket cache
break;
}
return $this->respond(['received' => true], 200);
}
}
Outbox Inspection & Dead-Letter Queue (DLQ)
Failed webhooks are retried with exponential backoff and jitter up to 5 attempts. Permanent 4xx client errors or exhausted retries are transitioned to dead (Dead-Letter Queue). Inspect and redeliver failed events at any time via:
GET/api/v1/outbox-events?status=dead
List failed events
POST/api/v1/outbox-events/{id}/redeliver
Immediate manual redelivery
Enterprise Reliability Invariants
Errors, Idempotency & Retries
Every mutation accepts an Idempotency-Key header. Replaying the identical request returns the current state with Idempotent-Replay: true without duplicate mutation or audit side effects.
HTTP Status
Classification
Recommended Client Action
200 / 201 / 202
Success / Ingestion Queued
Process response payload; for 202, poll operation status or await webhook.
400 / 422
Validation / Schema Error
Correct request payload format. Do not retry unmodified.
401
Unauthorized
Verify API Key header. Plaintext keys appear only once upon issuance.
403
Scope / Gate Denied
Check API client scopes or account portal-read permissions. Retrying will not grant access.
404
Not Found / Tenant Boundary
Confirm the target resource belongs to your authenticated organization.
409
Version / State Conflict
Draft version mismatch or unapproved draft state. Fetch latest draft and reconcile.
429
Rate Limited
Honor Retry-After header; use bounded exponential backoff.
500 / 502 / 503
Server / Portal Error
Record X-Request-ID and X-Correlation-ID; check status before retrying.
Structured Error Envelope
{
"error": {
"code": "validation_failed",
"message": "Iowa submission readiness check failed",
"request_id": "req-0a1b2c3d4e5f",
"correlation_id": "corr-0a1b2c3d4e5f",
"violations": [
"schedule.start_at: Proposed excavation start precedes the statutory Iowa 48-hour notice period. Under Iowa Code Β§ 480.1(5A) and Β§ 480.4(1)(a), excavation cannot commence before statutory conclusion (06:00 next business day + 48 business hours, excluding weekends/holidays). Notice filing lead time satisfies filing compliance only and does NOT grant excavation clearance."
]
}
}
Production Maturity Status
Capability Matrix & Roadmap
Up-to-date capability implementation status across the OCC platform architecture:
Production Ready Β· Database row leasing with FOR UPDATE SKIP LOCKED, Redis pub/sub wakeups.
Live Portal Traversal & Detail Reader
Phase 3
Production Ready Β· Deep ticket inspection (/tickets/detail), 4-layer fail-closed allowlists, PII masking.
Transactional Outbox & Webhooks
Phase 4
Production Ready Β· HMAC-SHA256 signed delivery, exponential backoff, DLQ, manual redelivery API.
Iowa Submit & Mutation Pipeline
Phase 5
Production Ready Β· Statutory notice calculation (Iowa Code Β§ 480.1(5A)), Iowa bounding box checks, verified dry-run simulation (SIM-IA-XXXX). Notice is not excavation clearance.
Nebraska OCC Portal & List Sync (NE)
Phase 6
Bounded Read Adapter Β· Gated login and sync of at most 100 first-page tickets and 5 details. Stored records are tenant-scoped. Live acceptance remains pending; full pagination and portal writes are unavailable.
Future Expansion (Kansas, Missouri)
Phase 7
Registry Only Β· State registry and account storage available. External automation adapters not implemented.
No matching endpoints found. Try searching by HTTP method (e.g. "POST"), scope (e.g. "tickets:read"), or URL path.
Company setupONE COMPANY API KEY
Create your OCC Developer Account
Create your account and receive one Company API key. Use that same key to connect One Dig and manage your state connections.
π‘οΈ
One company, one connection
Your key stays within your organization
βOne Company API key is included with signup. No second key is needed for One Dig.
βNo expiry date. Your key stays valid until you regenerate or revoke it.
βSeparate sign-in session. Dashboard sign-in does not replace the key saved in One Dig.
βCompany permissions cover state connections, tickets, drafts and staff access.
βYou control access. Replace a lost key or revoke a key you no longer use.
β‘ Immediate Development Access
No waiting for manual approvals. Your API key and tenant database record are provisioned immediately upon account creation.
Developer Registration
All fields marked with an asterisk are required.
Use at least 8 characters, including letters and digits.
Organization & Tenant Identity
Active Tenant Session
Developer
Work Email
Organization Name
Organization UUID
Your Company API key
One key for One Dig and all your state connections.
StatusLoadingβ¦
Expiryβ
Last usedβ
Company API key
Loadingβ¦
Checking your keyβ¦
Lost your key? Regenerate it here. Update One Dig immediately afterward; the previous key will stop working.
Connect One Dig
Copy your Company API key when it is shown.
Paste it into One Dig β Account β Company API connection.
Choose a state and enter that state's portal login.
Your dashboard sign-in uses your email and password. It does not need another API key.
π
API Console credentials
Use an existing key to test API requests
HTTPBearer (http, Bearer)
Enter an existing API key or access grant token for this organization. This only changes credentials for API Console requests; it does not create a key or update One Dig. Requests use Authorization: Bearer <key>.