Onboarding a new warehouse tenant in Dragon Guard is designed to be a single-request operation. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CodexaCP/DG_BACK/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/supreme/companies endpoint accepts an optional bootstrap object that lets the Supreme administrator provision the entire tenant stack — company record, SaaS plan subscription, integration API key, tenant admin user, handheld operator user, default scanner device, and initial warehouse structure — without any follow-up calls. Each bootstrap component is independently optional; omit any section to skip that step.
Bootstrap endpoint
Full bootstrap request example
How the bootstrap works
Create the company
The company record is created with all supplied fields.
code and name are required. code must be unique — the API returns 409 Conflict with COMPANY_CODE_ALREADY_EXISTS if it is already taken. An integration API key is generated immediately; its hash is stored and the plain key is returned once in the response.Assign the plan
If
planId is provided, the plan is looked up and the subscription is initialized in a single step:PlanStartsAtis set toplanStartsAt(orUtcNowif omitted).PlanExpiresAtis derived fromPlanStartsAtplus the plan’srenewalPeriod.PlanStatusis set toActive.DeviceLimitis initialized to the plan’smaxHandheldDevices.- A
CompanyPlanAuditrecord is written.
planId is supplied, the tenant is created with PlanStatus = Active and DeviceLimit = null (falls back to the plan default once assigned later).Generate integration API key
A cryptographically random API key is generated. The
ApiKeyHash (BCrypt) is stored on the company record. The plain text key is included in the create response under apiKey and is never retrievable again from any read endpoint.Create tenant admin
If
bootstrap.tenantAdmin is provided, a user is created (or reused if the email already exists in auth.Users) and assigned the specified roleCode for this tenant. The default role for admin bootstrap is ADMIN.- If
passwordisnullor omitted, the system generates the temporary password123456. MustChangePasswordis set totrue— the user must change their password on first login.- The plain temporary password is returned once in the response under
tenantAdmin.temporaryPassword.
Create handheld operator
If
bootstrap.handheldOperator is provided, a second user is created with roleCode = OPERATOR (or the specified role). The same temporary password rules apply. The plain password is returned once under handheldOperator.temporaryPassword.Pre-register handheld device
If
bootstrap.handheldDevice is provided, the device MAC address is normalized to uppercase colon-separated format (AA:BB:CC:DD:EE:FF) and inserted into core.HandheldDevices for the new tenant. The isActive flag determines whether login is immediately permitted.If the company’s deviceLimit is 0, the bootstrap will fail with plans.deviceLimitExceeded. Ensure deviceLimit ≥ 1 before registering a device.Bootstrap warehouse defaults
A default location and a default bin are created for the tenant. If
bootstrap.locationCode / bootstrap.binCode are omitted, they default to MAIN. These records are marked as the tenant’s default location and default bin, satisfying the operational requirement for receipts, shipments, and integration flows that rely on a default location context.Request fields reference
Top-level company fields
Short tenant code (e.g.,
ACME). Must be unique across all companies. For GrupoMAS Native tenants this maps to codigo_empresa in Grupo Mas.Display name of the company.
Enforced email domain for all users of this tenant (e.g.,
@acme.com). New user creation will reject emails that do not end with this domain.One of
Standalone, GrupoMasNative, or BusinessCentralNative. Defaults to Standalone.ID of the SaaS plan to assign at creation time. Optional — the tenant can be assigned a plan later via
POST /api/supreme/companies/{tenantId}/plans/assign.UTC start date for the plan subscription. Defaults to the moment of creation if omitted.
Initial company status:
Active, Inactive, or Suspended. Defaults to Active.Whether integration API access is enabled for this tenant from day one.
Optional company-level override for the maximum number of active handheld devices. When omitted, the plan’s
maxHandheldDevices value applies.Integration settings
Connection settings for GrupoMAS Native integration. Required when
integrationMode = GrupoMasNative.Connection settings for Business Central Native integration. Required when
integrationMode = BusinessCentralNative.Bootstrap object
Code for the default warehouse location. Defaults to
MAIN if omitted.Display name for the default location. Defaults to
MAIN if omitted.Code for the default bin within the default location. Defaults to
MAIN if omitted.Description for the default bin.
Optional. Creates an admin user for the tenant.
Optional. Creates a second user intended for handheld device login. Accepts the same fields as
tenantAdmin. Defaults roleCode to OPERATOR.Optional. Pre-authorizes a physical handheld device for this tenant.
Create response
Document sequences
Creating a company also seeds the following document sequence counters for the tenant, starting at zero:| Document Type | Purpose |
|---|---|
ITEM_CREATED | Item master auto-numbering |
RECEIPT_CREATED | Receiving header numbering |
POSTED_RECEIVE | Posted receipt numbering |
SHIPMENT_CREATE | Shipment header numbering |
POSTED_SHIPMENT | Posted shipment numbering |
PURCHASE_ORDER | Purchase order numbering |
SALES_ORDER | Sales order numbering |