API Integration Troubleshooting Guide
Several typical errors may occur when utilizing the Darwin Studio API for the first time. If you encounter challenges while integrating your application via the API, this list can assist you in troubleshooting. Should you still encounter difficulties, reach out to Darwin Studio support for additional help.
Invalid response from authorization hook
{
"error": "Invalid response from authorization hook",
"path": "$",
"code": "unexpected"
}
Verify that your API key adheres to a valid UUID format.
Ensure the accuracy of your API key.
Confirm that you are correctly configuring the API key. It should be included in the request header as authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
For instance, in the case of using the curl command:
curl --request POST \
–url https://cloud.darwinimages.ai/api/rest/v1/generations \
–header ‘accept: application/json’ \
–header ‘authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX’ \
–header ‘content-type: application/json’ \
–data ‘
{
“height”: 512,
“modelId”: “XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX”,
“prompt”: “An oil painting of a cat”,
“width”: 512
}
‘
Authentication hook unauthorized this request
{
"error": "Authentication hook unauthorized this request",
"path": "$",
"code": "access-denied"
}
Just like the case of an invalid response from the authorization hook, verify that you are configuring the API key accurately. It should be included in the request header as authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
Invalid file extension
{
"error": "invalid file extension",
"path": "$",
"code": "unexpected"
}
In the Upload Init Image API, the extension parameter refers to the file extension of the image intended for upload. File extensions such as png, jpg, jpeg, and webp are examples. It’s important to note that the extension parameter doesn’t accommodate filenames or image data.
Upon using the Upload Init Image API, a presigned URL is provided for image upload. For comprehensive instructions on utilizing the generated presigned URL, please refer to the guide: “How to upload an image using a presigned URL.”
Expected a boolean for type Boolean but found a string
{
"error": "expected a boolean for type 'Boolean', but found a string",
"path": "$.selectionSet.sdGenerationJob.args.arg1.photoReal",
"code": "validation-failed"
}
Verify whether your code is converting the input into a string instead of a Boolean value. Accepted values are true or false, and using “true” or “false” within quotation marks may be interpreted as a string.
Photoreal mode, unexpected model id provided
{
"error": "photoreal mode, unexpected model id provided",
"path": "$",
"code": "unexpected"
}
If photoReal is set to true, there is no need to specify a model. Eliminate the modelId parameter when utilizing photoReal.
Unexpected variable
{
"error": "Unexpected variable sd_Version",
"path": "$",
"code": "bad-request"
}
Ensure that you are accurately specifying the body parameter. Body parameters are case-sensitive. For instance, sd_version is the correct parameter, and specifying sd_Version will result in an unexpected variable error.
204 (No Content) when uploading an image
When utilizing a presigned URL to upload an image, the expected success response code is 204, and no content will be returned. The image ID is not included in this response. Instead, the image ID was already provided in the preceding step when calling the Upload Init Image API.
For instance, the image ID can be found under uploadInitImage.id as shown below:
{
"uploadInitImage": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"fields": …,
"key": …,
"url": …
}
}
403 Forbidden error when uploading an image
When utilizing a presigned URL to upload an image, it’s essential to exclude authentication-related headers, such as your API key. These headers are unnecessary when employing a presigned URL.
Couldn’t access image
{
"error": "couldn't access image",
"path": "$",
"code": "unexpected"
}
When working with features such as the Create Upscale API and Create Unzoom API, the anticipated image ID is the identifier of an image generated on Darwin Studio. This specific image ID can be obtained through the Get a Single Generation API.
For instance, the image ID can be found under generations_by_pk.generated_images[0].id as demonstrated below:
{
"generations_by_pk": {
"generated_images": [
{
"url": …,
"nsfw": …,
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"likeCount": …,
"generated_image_variation_generics": []
},
],
…
}
}
Currently, we don’t support using variations on images uploaded via the Upload Init Image API.
Failed to find init variation
{
"error": "failed to find init variation",
"path": "$",
"code": "unexpected"
}
Just like the case of being unable to access the image, the anticipated image ID pertains to the identifier of an image produced on Darwin Studio. This specific image ID is retrieved through the Get a Single Generation API.
It’s important to note that, at present, we do not provide support for using variations on images uploaded via the Upload Init Image API.
Invalid init image id
{
"error": "invalid init image id",
"path": "$",
"code": "unexpected"
}
Ensure that your init image ID adheres to a valid UUID format.
The init_image_id parameter accepts the image ID provided by the Upload Init Image API. If you intend to utilize an image generated in Darwin Studio as the init image, you should specify the image ID in the init_generation_image_id parameter instead.
200 Success but image URL array is empty
Issue: The Get a Single Generation API endpoint is delivering a 200 success response with an empty generations_by_pk.generated_images[]. Image URLs are not included.
Verify whether the response body includes “status”: “COMPLETE.” The endpoint provides the generations_by_pk.status attribute, where a successfully completed image generation would be indicated by a status of COMPLETE.
Image generation doesn’t happen instantly, so make sure not to retrieve the images immediately after submitting a generate images request. When using the User API, incorporate retries with exponential backoff. In the case of the Production API, designate a webhook callback during the API key creation to receive notifications on when to fetch your images.
Key Creation Error Occurred
Issue: Encountering a UI error stating “Key Creation Error Occurred” when generating a Production API key while specifying a webhook callback.
Verify that the webhook URL uses https instead of http. Using http may trigger the console error “WebhookCallbackUrl is not a valid url.”
{
"errors": [
{
"message": "WebhookCallbackUrl is not a valid url (must be https://)",
"extensions": {
"path": "$",
"code": "unexpected"
}
}
]
}
Failed to find init variation
{
"error": "failed to find init variation",
"path": "$",
"code": "unexpected"
}
When utilizing variation API endpoints such as unzoom and no background, configuring the isVariation parameter to true indicates that the supplied image ID is a result of a preceding variation.
For instance, suppose you employed the variation API endpoint upscale and obtained an image ID. In case you intend to apply the no background option to that ID, it’s essential to set isVariation to true.
If the ID does not originate from a previous variation, set isVariation to false or omit it.