GraphQL
Examples
End-to-end GraphQL examples for viewer, projects, RFIs, search, and file upload.
These examples assume a Bearer token from an organization API OAuth client or an organization membership session. Replace $organizationId and $projectId with UUIDs from viewer and organization.projects.
Who am I
query Viewer {
viewer {
userId
organizationId
organizationMembershipId
companyMembershipId
}
}
organizationId is the token's organization. Pass it to organization(id:).
List projects
query Projects($organizationId: ID!) {
organization(id: $organizationId) {
id
name
projects(first: 50) {
totalCount
nodes {
id
name
number
stage
live
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
List RFIs on a project
query ProjectRfis($organizationId: ID!, $projectId: ID!, $after: String) {
organization(id: $organizationId) {
project(id: $projectId) {
rfis(first: 50, after: $after) {
totalCount
nodes {
id
number
subject
status
dueOn
ballInCourtStatus
managerUser {
id
firstName
lastName
email
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
Create and open an RFI
Generate a UUID v7 for id. createDraftRfi requires subject and managerUserId (an organization member). Opening assigns the RFI number and notifies respondents.
mutation CreateDraftRfi(
$organizationId: ID!
$projectId: ID!
$input: CreateDraftRfiInput!
) {
organization(id: $organizationId) {
project(id: $projectId) {
createDraftRfi(input: $input) {
rfi {
id
status
subject
}
errors
}
}
}
}
{
"organizationId": "019e...",
"projectId": "019f...",
"input": {
"id": "019f...",
"subject": "Clarification on footing detail 5/S-201",
"managerUserId": "019e..."
}
}
mutation OpenRfi($organizationId: ID!, $projectId: ID!, $input: OpenRfiInput!) {
organization(id: $organizationId) {
project(id: $projectId) {
openRfi(input: $input) {
rfi {
id
number
status
}
errors
}
}
}
}
{
"input": { "id": "019f..." }
}
The id on openRfi is the RFI id, not a new id.
Search project content
query SearchProject($organizationId: ID!, $projectId: ID!, $query: String!) {
organization(id: $organizationId) {
project(id: $projectId) {
search(query: $query, first: 25) {
totalCount
nodes {
id
type
typeDisplayName
title
path
sanitizedHeadline
parentEntityTitle
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
Upload a file
See File uploads for checksums and the PUT step.
mutation CreateFileUpload(
$organizationId: ID!
$input: CreateFileUploadInput!
) {
organization(id: $organizationId) {
createFileUpload(input: $input) {
uploadUrl
uploadHeaders
signedId
errors
}
}
}
curl
TOKEN="..."
ORG="019e..."
curl -sS https://api.constructable.ai/graphql \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"query\":\"query(\$id: ID!) { organization(id: \$id) { id name } }\",\"variables\":{\"id\":\"$ORG\"}}"
$TOKEN is either an organization API OAuth access token (scope=api) or an organization membership session token. See Authentication.
Next
Browse types in the GraphQL reference. Mutation fields live on OrganizationMutations, ProjectMutations, and UserMutations.