API v0.3.1 · 46 endpoints

EMTITHAL Developer Portal

Saudi Building Code (SBC) compliance as a platform. Integrate permit-prep, rule-checking, and 7-year audit-by-replay into your workflow.

Interactive Reference Auth Guide ↓ Postman Collection ↓ OpenAPI Spec

Resources

📖

API Reference

Full interactive reference with try-it-out console. All 46 endpoints documented.

🔐

Authentication Guide

Register, login, refresh tokens, and secure your API calls with JWT Bearer auth.

⚠️

Error Codes

Bilingual error taxonomy. Every error code with HTTP status and AR/EN messages.

📄

OpenAPI Spec

Machine-readable OpenAPI 3.1 specification. Import into any compatible tool.

🚀

Postman Collection

Ready-to-import Postman collection with environment variables for base_url and JWT token.

🌐

Live API

Production endpoint: https://api.emtithal.aisc.sa


Quick Start

Get a JWT token in two API calls:

# 1. Register (one-time)
curl -X POST https://api.emtithal.aisc.sa/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.sa", "password": "S3cur3P@ss!"}'

# 2. Login to get your access token
curl -X POST https://api.emtithal.aisc.sa/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.sa", "password": "S3cur3P@ss!"}'

# Response contains access_token — use it as a Bearer token:
curl https://api.emtithal.aisc.sa/api/v1/auth/me \
  -H "Authorization: Bearer <access_token>"

See the Authentication Guide for the full flow including token refresh and logout.


Endpoints by Domain

MethodPathTagSummary
POST/api/v1/admin/code-editionsadminRegister a new tenant-scoped code-edition
POST/api/v1/admin/code-editions/{edition_id}/ingestadminKick off the ingestion workflow for a code-edition
GET/api/v1/admin/code-editions/{edition_id}/review-queueadminList rules pending engineer review for a code-edition
GET/api/v1/admin/code-editions/{edition_id}/statusadminReturn ingestion status + rule counts for a code-edition
POST/api/v1/auth/loginauthAuthenticate and obtain session tokens
POST/api/v1/auth/logoutauthLog out and invalidate session
GET/api/v1/auth/meauthRetrieve current user profile
POST/api/v1/auth/refreshauthRotate access token using refresh cookie
POST/api/v1/auth/registerauthRegister a new user account
POST/api/v1/auth/request-password-resetauthRequest a password-reset code
POST/api/v1/auth/reset-passwordauthReset password using the emailed code
POST/api/v1/auth/verify-emailauthVerify email and activate account
DELETE/api/v1/billing/me/subscriptionbillingSoft-cancel the caller's subscription (effective at period end)
GET/api/v1/billing/me/subscriptionbillingGet the caller's subscription (RLS-scoped)
POST/api/v1/billing/me/subscriptionbillingCreate a subscription for the caller (sign-up)
PATCH/api/v1/billing/me/subscription/paygbillingToggle PAYG opt-in + monthly ceiling
POST/api/v1/billing/me/subscription/reactivatebillingUndo a soft-cancel before the period ends
GET/api/v1/billing/me/usagebillingGet the caller's current-period usage meter
GET/api/v1/billing/plansbillingList published plan catalog
GET/api/v1/billing/plans/{plan_code}billingGet a single plan by code
POST/api/v1/billing/webhooks/moyasarwebhooks-moyasarMoyasar payment + subscription webhook intake (body-token verified)
GET/api/v1/codescodesList code-editions visible to the caller
POST/api/v1/codes/{code_id}/qacodesAsk a question about a code's rules (bilingual, with citations)
POST/api/v1/jobsjobsCreate a compliance check job
GET/api/v1/jobs/{job_id}jobsGet compliance job state
POST/api/v1/jobs/{job_id}/canceljobsCancel a running compliance job
GET/api/v1/jobs/{job_id}/eventsjobsStream job progress events (SSE)
POST/api/v1/jobs/{job_id}/overridejobsOverride a compliance verdict
GET/api/v1/jobs/{job_id}/result.pdfjobsGet verdict PDF download URL
GET/api/v1/jobs/{job_id}/rules/{rule_id}/verdictsjobsPer-element verdict drill-down for a single rule (AUD-048)
GET/api/v1/jobs/{job_id}/verdictsjobsList job verdicts in Phase-7 workbench shape (paginated)
POST/api/v1/jobs/{job_id}/versionsversionsCreate a new working version of a job (Phase 5 scaffold)
GET/api/v1/jobs/{job_id}/versions/{version_a}/diff/{version_b}versionsDiff verdicts between two versions of a job (Phase 9)
GET/api/v1/projectsprojectsList your projects
POST/api/v1/projectsprojectsCreate a project
POST/api/v1/projects/{project_id}/documentsprojectsRegister a document + get a presigned upload URL
POST/api/v1/projects/{project_id}/documents/{document_id}/completeprojectsFinalize an upload (head + hash the object, register the document)
GET/api/v1/projects/{project_id}/jobsjobsList compliance jobs for a project
GET/api/v1/rule-review/pdf/{filename}rule-reviewDownload SBC rule PDF
GET/api/v1/rule-review/queuerule-reviewList rule review queue items
GET/api/v1/rule-review/queue/{queue_id}rule-reviewGet detailed review queue item
PATCH/api/v1/rule-review/queue/{queue_id}rule-reviewApply incremental corrections to pending review item
POST/api/v1/rule-review/queue/{queue_id}/approverule-reviewApprove rule and finalize review
POST/api/v1/rule-review/queue/{queue_id}/rejectrule-reviewReject rule and return to submission queue
POST/api/v1/users/me/dsarusersSubmit a PDPL data-subject access/erasure request
GET/api/v1/webhooks/subscriptionswebhooksList webhook subscriptions visible to caller (RLS-scoped)
POST/api/v1/webhooks/subscriptionswebhooksRegister a webhook subscription
DELETE/api/v1/webhooks/subscriptions/{subscription_id}webhooksSoft-delete (deactivate) a webhook subscription
POST/api/v1/webhooks/subscriptions/{subscription_id}/testwebhooksSend a synchronous test ping to verify endpoint setup
GET/healthzhealthLiveness probe
GET/readyzhealthReadiness probe