Applications
This guide explains the Applications endpoint, which generates content from deployed no-code applications with inputs.
This guide will help you understand how to effectively interact with the Applications API. The Applications API allows you to turn deployed no-code applications into microservices. Business users can define inputs, prompts, and outputs, and developers can then add them to other applications, UIs, or services.
Here’s an overview of how to make requests to the endpoint and handle the responses.
Your API key can be generated using these steps.
Endpoint overview
The /applications
endpoint is designed to generate content based on the inputs provided to a specific no-code application created in AI Studio. You can specify various input parameters as defined in your application.
Note: Using the /applications
endpoint will result in charges for model usage. See the pricing page for more information.
When calling the /applications
endpoint, use the application_id
as the path parameter, which is the unique identifier of a no-code application in AI Studio.
The request body should be in JSON format with the following structure:
Here’s what the request will look like in cURL and the Writer Python and Node SDKs:
For each item in the input array, the id
will be replaced with the unique identifier for the input field from the application. This should be the name of the input type. The value
property will be the value(s) for the input field. For file inputs, use a file_id
obtained from the Files API.
For convenience, you can simply copy a code snippet from the No-code builder, as shown in the usage example below.
A successful request will return a JSON object with the following structure:
The content of title
will be the name of the output field. The suggestion will be the response from the model specified in the application.
Usage example
Here’s how to use the endpoint in a practical scenario:
Create a no-code text generation application
Use AI Studio to build a no-code text generation application by defining your inputs, prompts, and output formatting. You can follow this guide to get started.
Deploy your application
When your application is ready, follow this guide to deploy your application as an embedded application or to Writer.
Get the code snippet
Back in the Build tab, select the “View code” button to display a code snippet.
Copy code snippet
Copy the displayed code snippet. You can choose between cURL, Python, or JavaScript.
Create a request
Use your preferred HTTP client or one of the SDKs to send a POST request to the endpoint using the code snippet as a starting point. If using cURL, replace {API_KEY}
with your API key. If using the SDKs, ensure you have set up your WRITER_API_KEY
in your environment. Add any required input values.
Handle the response
Parse the JSON response to access the generated content.
Note that outputs without titles will return a value of null
.
Error handling
Ensure that potential errors, such as timeouts or model errors, are handled gracefully.
Rate limiting
Be aware of any rate limits that may apply to avoid service interruptions.
By following this guide, you can integrate the Applications endpoint into your projects to make the most of your no-code applications created in AI Studio. For more info on building no-code applications, check out the AI Studio No-code documentation.