Writer

App · 20 actions

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

Actions

ActionWhat it does
Ask graphQuestion.
ChatChat completion.
Create application jobGenerate from application (async).
Create graphCreate graph.
Delete fileDelete file.
Delete graphDelete graph.
Download fileDownload file.
Generate from applicationGenerate from application.
Generate textText generation.
Get applicationApplication details.
Get application jobRetrieve a single job.
Get fileRetrieve file.
Get graphRetrieve graph.
List application graphsRetrieve graphs.
List application jobsRetrieve all jobs.
List applicationsList applications.
List filesList files.
List graphsList graphs.
List modelsList models.
Update graphUpdate graph.

Ask graph

Question.

Inputs

Graph idsgraph_idslistRequired
The unique identifiers of the Knowledge Graphs to query.
Subqueriessubqueriestrue/false
Specify whether to include subqueries.Default: false.
QuestionquestiontextRequired
The question to answer using the Knowledge Graph.
Query configquery_configobject
Configuration options for Knowledge Graph queries, including search parameters and citation settings.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "answer": "example",
    "question": "example",
    "references": {
      "files": [],
      "web": []
    },
    "sources": [],
    "subqueries": []
  }
}

Chat

Chat completion.

Inputs

ModelmodeltextRequired
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.
MessagesmessageslistRequired
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 tokensmax_tokensnumber
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.
Temperaturetemperaturenumber
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 ptop_pnumber
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.
Nnnumber
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.
Stopstoplist
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.
Logprobslogprobstrue/false
Specifies whether to return log probabilities of the output tokens.Default: false.
Toolstoolslist
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 choicetool_choiceobject
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 formatresponse_formatobject
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

dataobject
Service response.
Example output
{
  "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

Applicationapplication_idtextRequired
Application id.
InputsinputslistRequired
A list of input objects to generate content for.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "id": "example",
    "status": "in_progress"
  }
}

Create graph

Create graph.

Inputs

Namenametext
The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name unchanged.
Descriptiondescriptiontext
A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the description unchanged.
Team idsteam_idslist
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

dataobject
Service response.
Example output
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "description": "example",
    "id": "example",
    "name": "example",
    "team_ids": [],
    "urls": []
  }
}

Delete file

Delete file.

Inputs

Filefile_idtextRequired
File id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "deleted": false,
    "id": "example"
  }
}

Delete graph

Delete graph.

Inputs

Graphgraph_idtextRequired
Graph id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "deleted": false,
    "id": "example"
  }
}

Download file

Download file.

Inputs

Filefile_idtextRequired
File id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "content_base64": "example",
    "content_type": "example"
  }
}

Generate from application

Generate from application.

Inputs

Applicationapplication_idtextRequired
Application id.
InputsinputslistRequired
Inputs.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "suggestion": "example",
    "title": "example"
  }
}

Generate text

Text generation.

Inputs

ModelmodeltextRequired
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.
PromptprompttextRequired
The input text that the model will process to generate a response.
Max tokensmax_tokensnumber
The maximum number of tokens that the model can generate in the response.
Temperaturetemperaturenumber
Controls the randomness of the model's outputs. Higher values lead to more random outputs, while lower values make the model more deterministic.
Top ptop_pnumber
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.
Stopstoplist
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 ofbest_ofnumber
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 seedrandom_seednumber
A seed used to initialize the random number generator for the model, ensuring reproducibility of the output when the same inputs are provided.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "choices": [],
    "model": "example"
  }
}

Get application

Application details.

Inputs

Applicationapplication_idtextRequired
Application id.

Outputs

dataobject
Detailed application object including its input configuration.
Example output
{
  "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 idjob_idtextRequired
Job id.

Outputs

dataobject
Service response.
Example output
{
  "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

Filefile_idtextRequired
File id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "graph_ids": [],
    "id": "example",
    "name": "example",
    "status": "example"
  }
}

Get graph

Retrieve graph.

Inputs

Graphgraph_idtextRequired
Graph id.

Outputs

dataobject
Service response.
Example output
{
  "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

Applicationapplication_idtextRequired
Application id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "graph_ids": []
  }
}

List application jobs

Retrieve all jobs.

Inputs

Applicationapplication_idtextRequired
Application id.
Statusstatustext
The status of the job.One of: in_progress (In progress), failed, completed.
Offsetoffsetnumber
Offset.
Limitlimitnumber
Limit.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "pagination": {
      "limit": 1,
      "offset": 1
    },
    "result": [],
    "totalCount": 1
  }
}

List applications

List applications.

Inputs

Orderordertext
Order.One of: asc, desc. Default: desc.
Beforebeforetext
Before.
Afteraftertext
After.
Limitlimitnumber
Limit.Default: 50.
Typetypetext
The type of no-code application.One of: generation. Default: generation.

Outputs

dataobject
Response object containing a paginated list of applications.
Example output
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}

List files

List files.

Inputs

Beforebeforetext
Before.
Afteraftertext
After.
Limitlimitnumber
Limit.Default: 50.
Orderordertext
Order.One of: asc, desc. Default: desc.
Graphgraph_idtext
Graph id.
Statusstatustext
Status.One of: in_progress (In progress), completed, failed.
File typesfile_typestext
File types.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}

List graphs

List graphs.

Inputs

Orderordertext
Order.One of: asc, desc. Default: desc.
Beforebeforetext
Before.
Afteraftertext
After.
Limitlimitnumber
Limit.Default: 50.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "first_id": "example",
    "has_more": false,
    "last_id": "example"
  }
}

List models

List models.

Inputs

None.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "models": []
  }
}

Update graph

Update graph.

Inputs

Graphgraph_idtextRequired
Graph id.
Namenametext
The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name unchanged.
Descriptiondescriptiontext
A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the description unchanged.
Urlsurlslist
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 idsteam_idslist
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

dataobject
Service response.
Example output
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "description": "example",
    "id": "example",
    "name": "example",
    "team_ids": [],
    "urls": []
  }
}

On this page