# runapp: AI Apps – Run App

> runapp (AI Apps – Run App) is a 1001fx API function in the group AI apps: POST https://api.1001fx.com/apps/runapp, 4 credits per 1,000 tokens (minimum 4). It works in Make, n8n, scripts and AI agents as a plain HTTP call.

Runs one of your AI apps (system prompt, knowledge bases and files, set up in the 1001fx app under AI Apps) and returns the answer, the sources and the files the app created. Prompt apps take prompt, form apps take input with the field keys of apps/getapp on the first run of a chat. Send chatId of the previous answer to continue the chat: the app sees the earlier messages. Files: file, file2, file3 (or fileUrl, fileUrl2, fileUrl3) for apps that accept files and for file fields of a form, in field order. Files the app creates are returned as links valid for 2 days. 1001fxGUARD protects every app: a request that tries to read the instructions or to change the role ends the chat (ended = true, start a new one). Apps are private: only API keys of the owner can run them. 4 credits per started 1,000 tokens (gpt-6.1-terra twice), plus 2 credits per created file and 6 per OCR page; chats are kept until deleted and count as storage like knowledge bases. Long runs: send x-fx-webhook.

- This service is provided by an external service provider: Microsoft Azure OpenAI. The data of the call is sent to the provider. [More about service providers](https://1001fx.com/functions#serviceproviders)

- Group: AI apps
- Endpoint: `POST https://api.1001fx.com/apps/runapp`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: multipart/form-data
- Credits: 4 credits per 1,000 tokens (minimum 4)
- Ready-made in: none, use an HTTP request
- Docs: https://1001fx.com/functions/runapp

## Parameters

- `app` (string, required) – App: Address of the app, e.g. sven/workflow-use-case-finder (shown in the 1001fx app under AI Apps → API).
- `prompt` (string, optional) – Prompt: The message (prompt apps, and follow-ups of form apps).
- `input` (any, optional) – Input: Form apps, first run of a chat: the values by field key, e.g. {"role": "Sales Manager"} (keys from apps/getapp). A file field takes a public URL here, or the name of the upload ("file", "file2", "file3"); without a value the uploads fill the file fields in order.
- `chatId` (string, optional) – Chat ID: chatId of the previous answer to continue the chat. Empty starts a new chat.
- `file` (file, optional) – File: The first file. Either file or fileUrl.
- `fileUrl` (string, optional) – File URL: Public URL of the first file. Either file or fileUrl.
- `file2` (file, optional) – File: The second file. Either file2 or file2Url.
- `fileUrl2` (string, optional) – File URL: Public URL of the second file. Either file2 or file2Url.
- `file3` (file, optional) – File: The third file. Either file3 or file3Url.
- `fileUrl3` (string, optional) – File URL: Public URL of the third file. Either file3 or file3Url.

## Example: AI Apps – Run App

```bash
curl -X POST 'https://api.1001fx.com/apps/runapp' \
  -H 'X-API-KEY: YOURSECRETAPIKEY'
```
