Skip to main content
POST
Step 3 — Generate BigQuery SQL from confirmed mappings
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

POST /source-creator/generate-queries Description: Generates the sales-data view query, royalty-sum query, and row-count query from the session’s confirmed mappings. Auto-derives tableNameFormat from the source name and the resolved accounting/sale period-source mode (column/filename/none) unless explicitly overridden. For “copy & modify” sessions (parentSourceId set), also infers transform patterns (exchange-rate join, COALESCE quantity fallback, nullIf, DSP override) from the parent source’s SQL and computes a versioned tableNameFormat. AI-calling — rate limited via aiRateLimitMiddleware. (Query building itself runs synchronously through QueryBuilderService, not an AI call, but the route carries the same limiter as ai-map-columns.) Authorization:
  • Required role: admin or higher
Method: POST

Code Examples

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Body

application/json
sessionId
string<uuid>
required
tableNameFormat
string | null

Explicit BigQuery table-name template override. Auto-derived from source name + period-source mode when omitted.

accountingPeriodSource
enum<string>

Overrides the auto-inferred accounting-period source mode.

Available options:
column,
filename,
none
salePeriodSource
enum<string>

Overrides the auto-inferred sale-period source mode.

Available options:
column,
filename,
none

Response

Queries generated successfully

status
string
Example:

"success"

message
string
Example:

"Queries generated successfully"

data
object