API Documentation

Authentication

To make requests to the API, you need an API Key, which you can obtain in the project settings.

You should pass the obtained API Key in the request headers as follows:

Authorization: Bearer API_KEY

Base url

The API is located at the following address:

https://api.rendapi.com/

HTTP codes

  • 200 OK. Everything is good.
  • 400 Bad Request. Your request is invalid.
  • 401 Unauthorized. API Key is wrong.
  • 402 Payment Required. You have reached the limit of the tariff quota.
  • 404 Not Found.
  • 429 Too Many Requests
  • 500 Internal Server Error. We had a problem with our server. Please try again later.
  • 503 Service Unavailable. We’re temporarily offline for maintenance.

Methods

Image Generation by URL

GET Method allows you to generate an image by simply replacing parameters in the URL.

/templates/{template_id}/render.jpg?{layer_name}={layer_value}
{template_id}Template ID
{layer_name}Layer Name
{layer_value}Value

Examples:

https://api.rendapi.com/templates/685a3dff-ae19-41b9-ab83-15e709cf4ac9/render.jpg?text-1=Hello+world!
https://api.rendapi.com/templates/685a3dff-ae19-41b9-ab83-15e709cf4ac9/render.pdf?text-1=I+am+PDF
Render Template

POST Advanced Image Generation Method. Allows overriding template parameters and layers (changing their appearance, position, and so on).

/templates/{template_id}/render

Parameters:

Parameter ValueDescription
configConfigTemplate Parameters
format“jpg” | “png” | “pdf”Output File Format

Example request:

JavaScript
const templateId = '685a3dff-ae19-41b9-ab83-15e709cf4ac9'
const overrideConfig = {
  "format" : "png",
  "config" : {
    "background": "#000000",
    "layers": [
      {
        "name": "text-1",
        "text": "Hello world!",
        "backgroundColor": "#FFFFFF"
      }
    ]
  },
}

fetch(`https://api.rendapi.com/templates/${templateId}/render`, {
  method: 'POST',
  body: JSON.stringify(overrideConfig),
  headers: {
    'Content-Type' : 'application/json',
    'Authorization' : `Bearer ${API_KEY}`
  }
})

Example response:

JSON
{
    "id": "56f549c2-4f50-4e78-a0de-07b7fa25f35b",
    "status": "success",
    "file": {
        "url": "https://api.rendapi.com/uploads/3cf281be-a857-4592-9f98-d1e4b68c6815/6ff89a7f-22fc-45e1-83b0-16eabd8f466a.png",
        "id": "57fa8a07-0f2a-4c1a-9c2c-04736e69acd7"
    },
    "error": null,
}

Objects

Config
ParameterValueDescription
heightnumberTemplate Height
widthnumberTemplate Width
backgroundstringBackground Color
layersLayer[]Template Layers
layerS

There are several types of layers: text, image, rectangle and circle. All layer types inherit common layer parameters.

layer

Common Layer Parameters

ParameterValueDescription
type“text” | “image” | “rect” | “circle”Layer Type
namestringLayer Name
xnumberLayer Placement on Template
ynumberLayer Placement on Template
widthnumberLayer Width
heightnumberLayer Height
rotationnumber (0-360)Layer Rotation
backgroundColorstringLayer Background Color
opacitynumber (0-100)Layer Opacity
Text layer
ParameterValueDescription
textstringText
alignItems“flex-start” | “center” | “flex-end”Vertical alignment of text
fontIdstringFont (from the supported list)
fontVariantstringFont Style (if the font supports styles)
fontSizenumberText Size
lineHeightnumberLine Spacing
lineClampnumberMaximum Number of Lines of Text (ellipsis will follow…)”
letterSpacingnumberLetter Spacing
mode“fit” | “auto-size” | “inline”“fit” – stretch the text (font size will be ignored)

“auto-size” – fit the text within bounds

“inline” – in a single line
colorstringText Color
textAlign“left” | “right” | “center” | “justify”Horizontal Alignment of Text
IMAGE layer
ParameterValueDescription
urlstringImage URL
objectFit“fill” | “contain” | “cover”Image Scaling
borderstringBorder
borderRadiusnumberImage Border Radius
RECTANGLE layer
ParameterValueDescription
borderstringBorder
borderRadiusnumberBorder Radius
CIRCLE layer
ParameterValueDescription
borderstringBorder