Generate image from JSON (legacy)
Generate an image from a JSON configuration and return a URL to access it
Migration notice
This API (the legacy blueprint API) no longer receives new features.
We strongly recommend migrating to the Generate image from template API. Design your template in HTML and define variables in the template editor; once it's published, you only need to pass in variables to generate images:
- HTML-based templates: Use the familiar tag structure of front-end development instead of the complex "blueprint" JSON protocol.
- Modern styling: Full support for inline styles (
style) and Tailwind CSS classes for quick layout. - Variables and conditional rendering: Reduce the data you need to send with each request.
- Multiple export formats: Export high-quality images as WebP, PNG, or JPEG.
Synchronously generates an image from the provided blueprint and returns a URL to access the image.
With this API, the caller controls the blueprint in real time, which offers the most flexibility.
Debug online and view the interactive API docs
Request
- HTTP URL:
https://api.imgrender.com/open/v1/pics - HTTP Method: POST
- Version: v1
Request parameters
Header parameters
| Field | Type | Required | Description |
|---|---|---|---|
| X-API-Key | string | yes | Used to authorize the request. See Authentication |
| Content-Type | string | yes | Fixed value: "application/json; charset=utf-8" |
Body parameters
The body must contain blueprint data and nothing else.
Response
When the request succeeds, the HTTP status code is 200 and data is returned as JSON:
{
"code": 0,
"message": "ok",
"data": {
"url": "https://davinci.imgrender.cn/6e31cfcd683a36d0522a8cc34e244379.jpg?sign=xxx"
}
}code: The error code.0means the request succeeded; any other value indicates a problem.message: A message corresponding tocode. For more messages, see Status codes and error codes.data: The returned data, present whencodeis0.urlis the image URL. The image URL is valid for 5 minutes, so download or display the image promptly. After it expires, send the request again to get a new URL.
Error codes
| Error code | HTTP status code | Description | Suggested action |
|---|---|---|---|
20105 | 403 | Image generation failed | Follow the instructions in the message |
For more common error codes, see Status codes and error codes.