Skip to main content

Generate Content

Now that we have prepared our template, we can now use it to create contents via API call.

API Call

POSThttps://api.fliki.ai/v1/generate/template

The endpoint needs to be executed with POST method and requires several inputs in body and header.

{
"Content-type": "application/json",
"Authorization": "Bearer API_KEY"
}
KeyValueDescription
Content-Typeapplication/jsonSpecifies that the request body format is JSON, allowing the server to parse the data correctly.
AuthorizationBearer YOUR_API_KEYGenerate your API Key in the account/api. section and replace YOUR_API_KEY with your actual key.

Body

{
"fileId": String,
"webhook": String,
"scenes": Array,
}
KeyTypeDescription
fileIdstringThe fileId is a unique identifier for the template you created earlier. You can retrieve it from the Templating popup when you first set it as a template.
webhookstringThe webhook is a public URL from your server that Fliki will call after your content has been generated. It should be a POST method endpoint to receive responses.
scenesarrayThe scenes object holds information for the scenes used in your template. This data structure will be passed when the content is generated.

Webhook is a URL, ideally from your own server, in which Fliki will call after your content has been generated. It should be a public endpoint with a POST method. It will receive a response specified below:

{
"success": Boolean
"data":{
"id": String | FILE_ID
"file": String | EXPORTED_FILE_URL
}
}

FILE_ID is the id of the generated content while the file is the url of the exported content which you can use for download.

Scenes field will be describe on the next section. The endpoint's response contain fileId property which gives you the file ID of the content generated.

Structuring your content

The scenes property will determine the scenes and layers included in your generated content. It is an Array of object with the shape provided below:

[
{
"key": "SCENE_KEY",
"layers": [
{
"key": "LAYER_KEY",
"text": "YOUR_CUSTOM_VALUE"
}
]
}
]

SCENE_KEY and LAYER_KEY were self-explanatory string value that should correspond to the keys you've set on your template while YOUR_CUSTOM_VALUE is a string or a number that will replace the default content of the layer.

The general idea of scenes is to define the scenes to be use and their sequence while layers array serve to provide content overrides for dynamic creation.

Checking the status

Webhook call allows you to know and handle content generation once it is done but you can also check its progress midway by calling the endpoint

GEThttps://api.fliki.ai/v1/generate/status

Query parameters

KeyTypeDescription
fileIdstringObtain this fileId from the response of a previous call to https://api.fliki.ai/v1/generate/template

Example

https://api.fliki.ai/v1/generate/status?fileId=

Response

{
"fileId": String,
"status": String,
"progress": Number | undefined,
"download": String | undefined
}
KeyTypeDescription
fileIdstringThe unique identifier for the file.
statusstatusIndicates the file generation status.
progressnumber | undefinedThe progress percentage of the file generation (if available).
downloadstring | undefinedThe URL to download the file (if available).

Congratulations

You now know how to use Fliki's Enterprise API to create contents. For a comprehensive detail of endpoints, you can check API Page.