API reference
Organization Query API
Retrieve your organization’s settings and its sweepstakes settings to build custom configuration views and displays across multiple sweepstakes.
https://backend.cleansweeps.app/graphqlOperation: QueryOrganization
Request
Send a JSON body with query and variables. Set Content-Type: application/json. Check both the HTTP response and GraphQL errors.
query QueryOrganization($organizationId: Int, $platform: String, $platformId: String) {
organization(id: $organizationId, platform: $platform, platformId: $platformId) {
id
plan
primaryEmail
uiConfig
referralBonusGive
referralBonusReceive
discountCodes
sweepstakes {
id
isActive
isOnline
startDate
endDate
title
entryManagement
entryTotal
}
emailDomainProfile {
id
status
domainName
dnsRecords
fromEmail
displayName
template
subject
}
}
}Variables
| Field | Type | Details |
|---|---|---|
organizationId | Int | Optional in the schema. Numeric organization ID. |
platform | String | Optional in the schema. Use Shopify for Shopify organizations. |
platformId | String | Optional in the schema. Shop GID. Supply identifiers appropriate to your organization. |
Authentication and Access Notes
This query is commonly used without an API key in current queryOrganization helper flows. For this reason, this documentation does not include x-api-key in the request examples. If your environment requires additional protection or custom server-side enforcement, authentication headers may be added separately by your implementation.
Available Response Fields
Expand available response fields
The following fields are available from organization queries and can be requested together. Organization Fields
- id
- plan
- primaryEmail
- uiConfig
- referralBonusGive
- referralBonusReceive
- discountCodes
- sweepstakes
- emailDomainProfile
Sweepstakes Fields
- id
- isActive
- isOnline
- startDate
- endDate
- title
- entryManagement
- entryTotal
Email Domain Profile Fields
- id
- status
- domainName
- dnsRecords
- fromEmail
- displayName
- template
- subject
Request Behavior
The backend allows querying an organization using one or more of the following inputs:
- organizationId
- platform
- platformId
These variables are optional at the GraphQL schema level. Your application helpers may supply different combinations depending on the use case.
Response (Shape & Meaning)
Expand response (shape & meaning)
Sample Response
{
"data": {
"organization": {
"id": 123,
"plan": "Diamond",
"primaryEmail": "info@example.com",
"uiConfig": "{...}",
"referralBonusGive": 10,
"referralBonusReceive": 5,
"discountCodes": "{\"WELCOME10\":{\"entryGive\":10,\"multiplierGive\":1}}",
"sweepstakes": [
{
"id": 123,
"isActive": true,
"isOnline": true,
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-04-26T23:59:59.000Z",
"title": "Spring Sweepstakes",
"entryManagement": "{...}",
"entryTotal": 5000
}
],
"emailDomainProfile": {
"id": 44,
"status": "ACTIVE",
"domainName": "mail.example.com",
"dnsRecords": "{...}",
"fromEmail": "support@example.com",
"displayName": "Clean Sweeps",
"template": "<html>...</html>",
"subject": "Welcome"
}
}
}
}Field Notes
Expand field notes
| Field | Type | Details |
|---|---|---|
id | number | The numeric ID of the organization. |
plan | string | The organization’s current plan tier. |
primaryEmail | string | The primary email address associated with the organization. |
uiConfig | JSON or string | Organization-level UI configuration used across the app. |
referralBonusGive | number | The referral bonus value awarded by the organization. |
referralBonusReceive | number | The referral bonus value received by the referred customer. |
discountCodes | JSON or string | Discount code configuration stored as JSON, often serialized as a string, then parsed in the UI. |
sweepstakes | array | A list of sweepstakes associated with the organization. |
emailDomainProfile | object | Email sending domain configuration associated with the organization. Sweepstakes Field Notes |
id | number | The numeric ID of the sweepstake. |
isActive | boolean | Whether the sweepstake is currently active. |
isOnline | boolean | Whether the sweepstake is visible or available online. |
startDate | datetime string | The sweepstake start date. |
endDate | datetime string | The sweepstake end date. |
title | string | The sweepstake title. |
entryManagement | JSON or string | Sweepstake entry management configuration. |
entryTotal | number | The total number of entries currently associated with the sweepstake. Email Domain Profile Field Notes |
id | number | The numeric ID of the email domain profile. |
status | string | The current status of the email domain profile. |
domainName | string | The sending domain configured for email delivery. |
dnsRecords | JSON or string | DNS record data required for domain verification and sending setup. |
fromEmail | string | The default from email address for the domain profile. |
displayName | string | The default display name used for outgoing email. |
template | string | The stored email template content. |
subject | string | The default email subject configured in the profile. |
Discount Codes Field
Expand discount codes field
discountCodes is stored and read as JSON, often serialized as a string, then parsed in the UI. Supported Shapes JSON object map:
{
"WELCOME10": { "entryGive": 10, "multiplierGive": 1 }
}JSON array (legacy-compatible parser path):
[
{
"code": "WELCOME10",
"entryGive": 10,
"multiplierGive": 1
}
]Recommended Canonical Shape
{
"WELCOME10": { "entryGive": 10, "multiplierGive": 1 },
"VIP2X": { "entryGive": 0, "multiplierGive": 2 }
}Current Helper Coverage
The following helpers currently exist in organization.ts: queryOrganization(...) Returns organization summary, sweepstakes, referral configuration, and UI config. queryOrganizationSweepstakesOnly(...) Returns a minimal sweepstakes list. queryOrganizationEmailDomainProfile(...) Returns organization data plus email domain profile. queryDiscountCodes(...) Returns discountCodes only.
Practical Example
Input
{
"organizationId": 123,
"platform": "Shopify",
"platformId": "gid://shopify/Shop/1234567890"
}Result This request can return:
- organization metadata such as plan and primary email
- referral configuration values
- discount code configuration
- associated sweepstakes records
- email domain profile configuration
The exact fields returned depend on the selection set included in the GraphQL query.
Best Practices
- Only request the fields your integration needs
- Use platform: "Shopify" when querying Shopify organizations in your current app flow
- Parse discountCodes safely because it may be returned as serialized JSON
- Prefer the canonical object-map structure for discountCodes when storing or consuming discount code configuration
- Avoid documenting or exposing unnecessary authentication headers in integrations that do not require them

