imgrender

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

FieldTypeRequiredDescription
X-API-KeystringyesUsed to authorize the request. See Authentication
Content-TypestringyesFixed 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. 0 means the request succeeded; any other value indicates a problem.
  • message: A message corresponding to code. For more messages, see Status codes and error codes.
  • data: The returned data, present when code is 0. url is 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 codeHTTP status codeDescriptionSuggested action
20105403Image generation failedFollow the instructions in the message

For more common error codes, see Status codes and error codes.

On this page