Build Riddles in your projects
By default the project of the accessing API key will be used - this means that if you use an API key created in your personal project the Riddle will always be added to your personal space.
To change this you can specify the project in the root to create the Riddle in a specific project.
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
project | integer | The ID of the project the Riddle should be created in | the project of the API key |
The project ID is resolved like this:
- If
projectis set, that project is used - no matter which key you use, as long as the key has access to that project. - Otherwise, a project API key builds in its own project.
- Otherwise (a personal API key without
project), the Riddle is created in your personal space.
Permissions
Your API key needs the create Riddle permission in the project you name, otherwise the request is rejected with an access error. The same applies to the batch endpoint, where project is applied to every Riddle of the batch.
The built Riddle belongs to the project, not to you personally: it is visible to everyone with access to that project, and the preset property resolves against the project's presets and palettes. Without a project, your personal preset is used instead.
Tip: GET /riddle-builder/presets/{projectId} returns the presets and palettes available for exactly that project - call it with the same ID you build in to get the values preset expects.
Example
The following example adds the built Riddle to the project with the ID 123:
{
"type": "Poll",
"project": 123,
"build": {
"title": "Favorite color poll",
"blocks": [
{
"title": "What's your favorite color?",
"type": "SingleChoice",
"items": [
{ "title": "green" },
{ "title": "red" }
]
}
],
"result": {
"title": "Thank you",
"description": "Thanks for your vote."
}
}
}

