Skip to content

API Reference

All routes are nested under /api/v1 except health and metrics endpoints.

https://api-blocmarket.wyattau.com

Local development:

http://localhost:8090

Protected endpoints require a JWT in the Authorization header:

Authorization: Bearer <jwt_token>

Obtain a token via POST /api/v1/auth/register or POST /api/v1/auth/login. The login response is flat: { "access_token", "refresh_token" }.

Enterprise endpoints accept either a JWT or an API key:

Authorization: Bearer bmk_live_...

Enterprise OAuth clients exchange client credentials at POST /api/v1/enterprise/oauth/oauth/token.

Most endpoints return { "data": { ... } }. Some endpoints return flat responses (noted in the tables below, e.g. login and bloc detail).

Errors follow RFC 7807 Problem Details with content type application/problem+json:

{
"type": "https://blocmarket.org/errors/validation",
"title": "Validation failed",
"status": 400,
"detail": "amount must be greater than zero"
}
StatusMeaning
400Validation error
401Authentication required or token expired
403Insufficient permissions / CORS rejection
404Resource not found
409Conflict (duplicate)
429Rate limit exceeded

Rate limiting is Redis-based with tiered limits:

TierRequestsPeriodApplied To
Auth1560s/auth/*, /enterprise/oauth/*
Public10060s/search/*
User100060sAll protected routes
EnterprisePer-client60sEnterprise API key routes

Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and Retry-After (on 429). If Redis is unavailable, all requests are allowed (graceful degradation).

Paginated endpoints accept page (default 1) and per_page or limit (default 20, max 100):

{ "data": [ ... ], "total": 42, "page": 1, "per_page": 20 }

No authentication required. No rate limiting.

MethodPathDescription
GET/API status check
GET/healthHealth check (static)
GET/health/dbDatabase connectivity (SELECT 1)
GET/health/redisRedis connectivity (TCP)
GET/readyComposite readiness (DB + Redis)
GET/metricsPrometheus metrics (text exposition)
WS/wsWebSocket notification stream

No JWT required. Rate limited: 15 req/min.

MethodPathDescription
POST/api/v1/auth/registerRegister new user
POST/api/v1/auth/loginLogin (flat { "access_token", "refresh_token" })
POST/api/v1/auth/refreshRefresh access token
POST/api/v1/auth/forgot-passwordRequest password reset email
POST/api/v1/auth/reset-passwordReset password with token
POST/api/v1/auth/verify-emailVerify email with token

JWT required.

MethodPathDescription
GET/api/v1/users/profileGet current user profile
PATCH/api/v1/users/profileUpdate profile
POST/api/v1/users/passwordChange password
POST/api/v1/users/account/deleteSoft-delete account
POST/api/v1/users/account/restoreRestore soft-deleted account
GET/api/v1/users/me/exportExport all user data (GDPR)
GET/api/v1/users/me/export/statusCheck export status
DELETE/api/v1/users/mePermanent account deletion (GDPR)

JWT required. Rate limited: 1000 req/min.

MethodPathDescription
POST/api/v1/propertiesCreate property
GET/api/v1/properties/searchSearch properties (paginated)
GET/api/v1/properties/nearbyFind properties near coordinates
GET/api/v1/properties/within-boundsFind properties within bounding box
GET/api/v1/properties/{id}Get property by ID
PUT/api/v1/properties/{id}Update property
PUT/api/v1/properties/{id}/statusUpdate property status
DELETE/api/v1/properties/{id}Delete property

JWT required.

MethodPathDescription
GET/api/v1/blocsList blocs (paginated)
POST/api/v1/blocsCreate bloc
GET/api/v1/blocs/{id}Get bloc by ID (flat BlocDto)
PUT/api/v1/blocs/{id}Update bloc
DELETE/api/v1/blocs/{id}Delete bloc
POST/api/v1/blocs/{id}/propertiesAdd property to bloc
DELETE/api/v1/blocs/{id}/properties/{property_id}Remove property from bloc
POST/api/v1/blocs/{id}/eventsSubmit bloc state event (flat BlocDto)
GET/api/v1/blocs/{id}/transitionsGet transition history
POST/api/v1/blocs/{id}/proposalsCreate bloc proposal
POST/api/v1/blocs/{id}/proposals/{proposal_id}/voteCast vote on proposal

JWT required.

MethodPathDescription
GET/api/v1/bidsList bids (paginated)
POST/api/v1/bidsCreate bid
GET/api/v1/bids/{id}Get bid by ID
PUT/api/v1/bids/{id}Update bid
DELETE/api/v1/bids/{id}Delete bid
POST/api/v1/bids/{id}/acceptAccept bid
POST/api/v1/bids/{id}/rejectReject bid

JWT required.

MethodPathDescription
GET/api/v1/transactionsList transactions (paginated)
POST/api/v1/transactionsCreate transaction
GET/api/v1/transactions/{id}Get transaction by ID
PUT/api/v1/transactions/{id}Update transaction fields
PUT/api/v1/transactions/{id}/statusUpdate transaction status
POST/api/v1/transactions/{id}/cancelCancel transaction
GET/api/v1/transactions/{id}/milestonesGet transaction milestones
GET/api/v1/transactions/bloc/{bloc_id}/activeGet active transaction for bloc

JWT required.

MethodPathDescription
GET/api/v1/paymentsList payments
POST/api/v1/paymentsCreate payment
POST/api/v1/payments/calculate-feeCalculate platform fee
POST/api/v1/payments/intentCreate Stripe payment intent
POST/api/v1/payments/searchSearch payments
GET/api/v1/payments/{id}Get payment by ID
PUT/api/v1/payments/{id}Update payment
DELETE/api/v1/payments/{id}Delete payment
PUT/api/v1/payments/{id}/statusUpdate payment status
POST/api/v1/payments/refundCreate refund
POST/api/v1/payments/webhookStripe webhook handler
POST/api/v1/payments/truelayer/create-intentCreate TrueLayer payment intent
POST/api/v1/payments/truelayer/create-paymentExecute TrueLayer payment

JWT required.

MethodPathDescription
POST/api/v1/notificationsCreate notification
GET/api/v1/notificationsList notifications
GET/api/v1/notifications/searchSearch notifications
GET/api/v1/notifications/{id}Get notification by ID
PATCH/api/v1/notifications/{id}/readMark as read
PATCH/api/v1/notifications/read-allMark all as read
DELETE/api/v1/notifications/{id}Delete notification
GET/api/v1/notifications/preferencesGet notification preferences
PATCH/api/v1/notifications/preferencesUpdate preferences
POST/api/v1/notifications/devices/registerRegister push device
POST/api/v1/notifications/devices/unregisterUnregister push device

No JWT required. Rate limited: 100 req/min.

MethodPathDescription
GET/api/v1/search/searchGlobal search

All endpoints require JWT. Each product has full CRUD plus domain-specific operations:

ProductBase PathDomain Operations
Site Assemblies/api/v1/site-assembliesValidate assembly, check contiguity
Rooftop Assemblies/api/v1/rooftop-assembliesAir rights valuation, PD rights assessment
Nutrient Credits/api/v1/nutrient-creditsCalculate credit yield, transfer credits
SANOS (BNG)/api/v1/sanosHabitat quality, link to development, NE approval
Section 106/api/v1/section-106Match affordable housing sites, link luxury development
BESS Sites/api/v1/bess-sitesProximity search, substation validation, suitability
Edge Data Centers/api/v1/edge-data-centersFiber availability, PUE estimate
Industrial Storage/api/v1/industrial-storageRevenue estimate, suitability
Telecom Leases/api/v1/telecom-leasesSite/lease CRUD, line-of-sight analysis

JWT or API key (Bearer bmk_live_...) required.

MethodPathDescription
GET / POST/api/v1/enterprise/clientsList / create enterprise clients
GET / PUT / DELETE/api/v1/enterprise/clients/{client_id}Manage client
POST/api/v1/enterprise/clients/{client_id}/regenerate-webhook-secretRegenerate webhook secret
POST/api/v1/enterprise/clients/{client_id}/test-webhookTest webhook delivery
GET/api/v1/enterprise/keysList API keys
POST/api/v1/enterprise/clients/{client_id}/keysCreate API key
DELETE/api/v1/enterprise/keys/{key_id}Delete API key
POST/api/v1/enterprise/keys/{key_id}/revokeRevoke API key
POST/api/v1/enterprise/clients/{client_id}/revoke-tokensRevoke OAuth tokens

JWT required.

MethodPathDescription
POST/api/v1/docusign/send-envelopeSend DocuSign envelope
GET/api/v1/docusign/envelope/{envelope_id}/statusGet envelope status
POST/api/v1/docusign/envelope/{envelope_id}/voidVoid envelope

JWT required. Admin role check in handlers.

MethodPathDescription
GET/api/v1/admin/statsSystem statistics
GET/api/v1/admin/activityRecent activity
PATCH/api/v1/admin/users/roleChange user role

Interactive API documentation is available at:

/api-docs/ui/

OpenAPI JSON spec:

/api-docs/openapi.json

Swagger UI is enabled by default in development. Disable in production with SWAGGER_UI_ENABLED=false.

Connect to /ws with a valid JWT for real-time updates:

ws://localhost:8090/ws?token=<jwt>

Events stream: bid updates, notification delivery, bloc state changes.

Applied to all responses:

HeaderValue
Content-Security-Policydefault-src 'none'; connect-src 'self'; frame-ancestors 'none'
Strict-Transport-Securitymax-age=63072000; includeSubDomains; preload
X-Frame-OptionsDENY
X-Content-Type-Optionsnosniff
X-XSS-Protection1; mode=block
Referrer-Policystrict-origin-when-cross-origin
Permissions-Policycamera=(), microphone=(), geolocation=()
Cross-Origin-Embedder-Policyrequire-corp
Cross-Origin-Opener-Policysame-origin
ServerBlocMarket (version hidden)