This guide explains the async application jobs endpoints, which allow you to generate content asynchronously from deployed no-code applications and manage the resulting jobs.

With async applications, your team can build and deploy no-code applications in AI Studio and you can then use those applications to generate content programmatically.

For example, your marketing team can build a no-code application that generates social media posts, and then you can use the async applications API to generate posts in batches for multiple channels.

This guide will help you understand how to use the Applications async jobs API. This API is similar to the no-code applications API, but it allows you to process batches of content generation requests asynchronously.

You need an API key to use the async applications endpoints. Follow these steps to generate an API key.

Overview

The async Applications API consists of several endpoints:

  • POST /applications/{application_id}/jobs: Create an async job
  • GET /applications/{application_id}/jobs: List all jobs
  • GET /applications/jobs/{job_id}: Get a single job’s status
  • POST /applications/jobs/{job_id}/retry: Retry a failed job

Using the async applications endpoints results in charges for model usage. See the pricing page for more information.

Async job object

The async job object is defined as follows:

ParameterTypeDescription
inputsarrayAn array of input objects matching the no-code application’s input schema
inputs[].idstringThe name of the input
inputs[].valuearrayThe value of the input
{
  "inputs": [
    {
      "id": "string",
      "value": ["string"]
    }
  ]
}

You can find the input schema for a no-code application by calling the no-code applications API or by viewing the application’s configuration in AI Studio.

Create an async job

Here’s what creating an async job looks like using cURL and the Writer Python and Node SDKs. You can find the application ID in the URL of the no-code application’s configuration page in AI Studio, or by listing your applications with the no-code applications API.

curl 'https://api.writer.com/v1/applications/your-application-id/jobs' \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
--data-raw '{
  "inputs": [
    {
      "id": "Input name",
      "value": [
        "Input value"
      ]
    }
  ]
}'

A successful job creation request returns a JSON object with the following structure:

ParameterTypeDescription
job_idstringThe ID of the job
statusstringThe status of the job. Can be in_progress, completed, or failed.
created_atstringThe date and time the job was created
{
  "job_id": "123-456-789",
  "status": "in_progress",
  "created_at": "2024-03-15T10:00:00Z"
}

Usage example

Here’s how to use the async endpoints in a practical scenario:

1

Create and deploy a no-code application

First, create and deploy a no-code application in AI Studio. If you don’t already have a no-code application in AI Studio, you can follow the text generation app guide or chat app guide to get started.

2

Create an async job

Send a POST request with the inputs for the application to create an async job.

curl 'https://api.writer.com/v1/applications/1234-45090-534590/jobs' \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
--data-raw '{
  "inputs": [
    {
      "id": "Product descriptions",
      "value": [
        "Terra running shoe",
        "Aqua swim goggles",
        "Flex yoga mat"
      ]
    }
  ]
}'
3

Check job status

Use the job ID from the creation response to check the status of your job:

curl 'https://api.writer.com/v1/applications/jobs/your-job-id' \
-H 'Authorization: Bearer {API_KEY}'

The response will include the current status and, if completed, the results:

{
    "id": "123-456-789",
    "status": "completed",
    "application_id": "2932402-23429023894-234234234",
    "created_at": "2025-02-10T18:18:09.501223Z",
    "completed_at": "2025-02-10T18:18:14.470324Z",
    "data": {
        "title": "Social post",
        "suggestion": "# Social post\nImage: A photo of a person running in a pair of Terra running shoes.\n\nCaption:\n\nIntroducing the all-new Terra running shoe, designed to take you further than ever before. With its innovative cushioning system and durable outsole, the Terra is perfect for runners of all levels.\n\nWhether you're hitting the trails or pounding the pavement, the Terra will keep you comfortable and supported mile after mile. So what are you waiting for? Lace up a pair of Terras and start your journey today!\n\n#TerraRunningShoe #RunFurther #NeverStopExploring #GetOutside"
    },
    "error": null
}
4

List all jobs

You can retrieve all jobs for an application to monitor batch processing:

curl 'https://api.writer.com/v1/applications/your-application-id/jobs' \
-H 'Authorization: Bearer {API_KEY}'
5

Retry failed jobs

If a job fails, you can retry it using the retry endpoint:

curl 'https://api.writer.com/v1/applications/jobs/your-job-id/retry' \
-X POST \
-H 'Authorization: Bearer {API_KEY}'
6

Error handling

Implement proper error handling for various scenarios:

  • Job creation failures
  • Invalid job IDs
  • Network timeouts
  • Rate limiting errors
7

Rate limiting

Be aware of rate limits that apply to async operations. Consider implementing backoff strategies for status polling.

By following this guide, you can use the async Applications API to handling large-scale content generation tasks. For more information on building no-code applications, check out the AI Studio No-code documentation.