# Writer

> Generate text and chat responses, run applications, and manage knowledge graphs and files.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/writer

## Actions

### Ask graph

Question.

**Inputs**

- Graph ids (`graph_ids`, list, required): The unique identifiers of the Knowledge Graphs to query.
- Subqueries (`subqueries`, true/false): Specify whether to include subqueries. Default: `false`.
- Question (`question`, text, required): The question to answer using the Knowledge Graph.
- Query config (`query_config`, object): Configuration options for Knowledge Graph queries, including search parameters and citation settings.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "answer": "example",
    "question": "example",
    "references": {
      "files": [],
      "web": []
    },
    "sources": [],
    "subqueries": []
  }
}
```

### Chat

Chat completion.

**Inputs**

- Model (`model`, text, required): The [ID of the model](https://dev.writer.com/home/models) to use for creating the chat completion. This can be a Palmyra model such as `palmyra-x5` or `palmyra-x4`, or the ID of an [external model](https://dev.writer.com/home/external-models) configured for your organization.
- Messages (`messages`, list, required): An array of message objects that form the conversation history or context for the model to respond to. The array must contain at least one message.
- Max tokens (`max_tokens`, number): Defines the maximum number of tokens (words and characters) that the model can generate in the response. This can be adjusted to allow for longer or shorter responses as needed. The maximum value varies by model. See the [models overview](/home/models) for more information about the maximum number of tokens for each model.
- Temperature (`temperature`, number): Controls the randomness or creativity of the model's responses. A higher temperature results in more varied and less predictable text, while a lower temperature produces more deterministic and conservative outputs. Default: `1`.
- Top p (`top_p`, number): Sets the threshold for "nucleus sampling," a technique to focus the model's token generation on the most likely subset of tokens. Only tokens with cumulative probability above this threshold are considered, controlling the trade-off between creativity and coherence.
- N (`n`, number): Specifies the number of completions (responses) to generate from the model in a single request. This parameter allows for generating multiple responses, offering a variety of potential replies from which to choose.
- Stop (`stop`, list): A token or sequence of tokens that, when generated, will cause the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output.
- Logprobs (`logprobs`, true/false): Specifies whether to return log probabilities of the output tokens. Default: `false`.
- Tools (`tools`, list): An array containing tool definitions for tools that the model can use to generate responses. The tool definitions use JSON schema. You can define your own functions or use one of the built-in `graph`, `llm`, or `web_search` tools. Note that you can only use one built-in tool type in the array (only one of `graph`, `llm`, or `web_search`). You can pass multiple [custom tools](https://dev.writer.com/home/tool-calling) of type `function` in the same request.
- Tool choice (`tool_choice`, object): Configure how the model will call functions: - `auto`: allows the model to automatically choose the tool to use, or not call a tool - `none`: disables tool calling; the model will instead generate a message - `required`: requires the model to call one or more tools You can also use a JSON object to force the model to call a specific tool. For example, `{"type": "function", "function": {"name": "get_current_weather"}}` requires the model to call the `get_current_weather` function, regardless of the prompt.
- Response format (`response_format`, object): The response format to use for the chat completion, available with `palmyra-x4` and `palmyra-x5`. `text` is the default response format. [JSON Schema](https://json-schema.org/) is supported for structured responses. If you specify `json_schema`, you must also provide a `json_schema` object.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "choices": [],
    "created": 1,
    "id": "example",
    "model": "example",
    "object": "chat.completion",
    "service_tier": "example",
    "system_fingerprint": "example",
    "usage": {
      "completion_tokens": 1,
      "completion_tokens_details": {
        "reasoning_tokens": 1
      },
      "prompt_token_details": {
        "cached_tokens": 1
      },
      "prompt_tokens": 1,
      "total_tokens": 1
    }
  }
}
```

### Create application job

Generate from application (async).

**Inputs**

- Application (`application_id`, text, required): Application id.
- Inputs (`inputs`, list, required): A list of input objects to generate content for.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "id": "example",
    "status": "in_progress"
  }
}
```

### Create graph

Create graph.

**Inputs**

- Name (`name`, text): The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name unchanged.
- Description (`description`, text): A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the description unchanged.
- Team ids (`team_ids`, list): Optional list of team IDs to deploy the Knowledge Graph to. Omit the field or pass an empty array to create an org-wide Knowledge Graph (accessible to every team in the organization), which is the default. Provide one or more team IDs to scope the Knowledge Graph to those teams. Only applies when using an org-scoped API key; requests made with a team-scoped API key ignore this field and always assign the graph to that key's team.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "description": "example",
    "id": "example",
    "name": "example",
    "team_ids": [],
    "urls": []
  }
}
```

### Delete file

Delete file.

**Inputs**

- File (`file_id`, text, required): File id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "deleted": false,
    "id": "example"
  }
}
```

### Delete graph

Delete graph.

**Inputs**

- Graph (`graph_id`, text, required): Graph id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "deleted": false,
    "id": "example"
  }
}
```

### Download file

Download file.

**Inputs**

- File (`file_id`, text, required): File id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "content_base64": "example",
    "content_type": "example"
  }
}
```

### Generate from application

Generate from application.

**Inputs**

- Application (`application_id`, text, required): Application id.
- Inputs (`inputs`, list, required): Inputs.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "suggestion": "example",
    "title": "example"
  }
}
```

### Generate text

Text generation.

**Inputs**

- Model (`model`, text, required): The [ID of the model](https://dev.writer.com/home/models) to use for generating text. This can be a Palmyra model such as `palmyra-x5` or `palmyra-x4`, or the ID of an [external model](https://dev.writer.com/home/external-models) configured for your organization.
- Prompt (`prompt`, text, required): The input text that the model will process to generate a response.
- Max tokens (`max_tokens`, number): The maximum number of tokens that the model can generate in the response.
- Temperature (`temperature`, number): Controls the randomness of the model's outputs. Higher values lead to more random outputs, while lower values make the model more deterministic.
- Top p (`top_p`, number): Used to control the nucleus sampling, where only the most probable tokens with a cumulative probability of top_p are considered for sampling, providing a way to fine-tune the randomness of predictions.
- Stop (`stop`, list): Specifies stopping conditions for the model's output generation. This can be an array of strings or a single string that the model will look for as a signal to stop generating further tokens.
- Best of (`best_of`, number): Specifies the number of completions to generate and return the best one. Useful for generating multiple outputs and choosing the best based on some criteria.
- Random seed (`random_seed`, number): A seed used to initialize the random number generator for the model, ensuring reproducibility of the output when the same inputs are provided.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "choices": [],
    "model": "example"
  }
}
```

### Get application

Application details.

**Inputs**

- Application (`application_id`, text, required): Application id.

**Outputs**

- `data` (object): Detailed application object including its input configuration.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "id": "example",
    "inputs": [],
    "last_deployed_at": "2026-11-01T12:00:00Z",
    "name": "example",
    "status": "deployed",
    "type": "generation",
    "updated_at": "2026-11-01T12:00:00Z"
  }
}
```

### Get application job

Retrieve a single job.

**Inputs**

- Job id (`job_id`, text, required): Job id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "application_id": "example",
    "completed_at": "2026-11-01T12:00:00Z",
    "created_at": "2026-11-01T12:00:00Z",
    "data": {
      "suggestion": "example",
      "title": "example"
    },
    "error": "example",
    "id": "example",
    "status": "in_progress",
    "updated_at": "2026-11-01T12:00:00Z"
  }
}
```

### Get file

Retrieve file.

**Inputs**

- File (`file_id`, text, required): File id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "graph_ids": [],
    "id": "example",
    "name": "example",
    "status": "example"
  }
}
```

### Get graph

Retrieve graph.

**Inputs**

- Graph (`graph_id`, text, required): Graph id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "description": "example",
    "file_status": {
      "completed": 1,
      "failed": 1,
      "in_progress": 1,
      "total": 1
    },
    "id": "example",
    "name": "example",
    "team_ids": [],
    "type": "manual",
    "urls": []
  }
}
```

### List application graphs

Retrieve graphs.

**Inputs**

- Application (`application_id`, text, required): Application id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "graph_ids": []
  }
}
```

### List application jobs

Retrieve all jobs.

**Inputs**

- Application (`application_id`, text, required): Application id.
- Status (`status`, text): The status of the job. One of: `in_progress` (In progress), `failed`, `completed`.
- Offset (`offset`, number): Offset.
- Limit (`limit`, number): Limit.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "pagination": {
      "limit": 1,
      "offset": 1
    },
    "result": [],
    "totalCount": 1
  }
}
```

### List applications

List applications.

**Inputs**

- Order (`order`, text): Order. One of: `asc`, `desc`. Default: `desc`.
- Before (`before`, text): Before.
- After (`after`, text): After.
- Limit (`limit`, number): Limit. Default: `50`.
- Type (`type`, text): The type of no-code application. One of: `generation`. Default: `generation`.

**Outputs**

- `data` (object): Response object containing a paginated list of applications.

**Example output**

```json
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}
```

### List files

List files.

**Inputs**

- Before (`before`, text): Before.
- After (`after`, text): After.
- Limit (`limit`, number): Limit. Default: `50`.
- Order (`order`, text): Order. One of: `asc`, `desc`. Default: `desc`.
- Graph (`graph_id`, text): Graph id.
- Status (`status`, text): Status. One of: `in_progress` (In progress), `completed`, `failed`.
- File types (`file_types`, text): File types.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}
```

### List graphs

List graphs.

**Inputs**

- Order (`order`, text): Order. One of: `asc`, `desc`. Default: `desc`.
- Before (`before`, text): Before.
- After (`after`, text): After.
- Limit (`limit`, number): Limit. Default: `50`.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}
```

### List models

List models.

**Inputs**: None.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "models": []
  }
}
```

### Update graph

Update graph.

**Inputs**

- Graph (`graph_id`, text, required): Graph id.
- Name (`name`, text): The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name unchanged.
- Description (`description`, text): A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the description unchanged.
- Urls (`urls`, list): An array of web connector URLs to update for this Knowledge Graph. You can only connect URLs to Knowledge Graphs with the type `web`. To clear the list of URLs, set this field to an empty array.
- Team ids (`team_ids`, list): Optional list of team IDs the Knowledge Graph is deployed to. Omitting this field leaves the current team assignment unchanged. Passing an array replaces the whole team assignment: an empty array makes the graph org-wide, one or more team IDs scope it to exactly those teams. Not accepted from team-scoped API keys.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "description": "example",
    "id": "example",
    "name": "example",
    "team_ids": [],
    "urls": []
  }
}
```
