> ## Documentation Index
> Fetch the complete documentation index at: https://ona.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Prompt

> Updates an existing prompt.

`Unary` · [`Agents`](/docs/api-reference/generated/agent/overview)

Updates an existing prompt.

Use this method to:

* Modify prompt content or metadata
* Change prompt type (template/command)

## Endpoint

```text theme={null}
POST /api/gitpod.v1.AgentService/UpdatePrompt
```

Send a Bearer token as described in [Authentication](/docs/api-reference#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

<CodeGroup>
  ```bash cURL theme={null}
  export ONA_HOST=https://app.ona.com
  export ONA_API_KEY=<your-token>

  curl --request POST \
    --url "$ONA_HOST/api/gitpod.v1.AgentService/UpdatePrompt" \
    --header "Authorization: Bearer $ONA_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
    "promptId": "<prompt-id>"
  }'
  ```

  ```python Python theme={null}
  import gitpod.v1.agent_pb2 as agent_pb2
  from ona_sdk import create_client_from_env

  ona = create_client_from_env()
  request = agent_pb2.UpdatePromptRequest(
      prompt_id="<prompt-id>",
  )
  response = ona.services.agent.update_prompt(request)
  print(response)
  ```

  ```typescript TypeScript theme={null}
  import { create } from "@bufbuild/protobuf";
  import { createClientFromEnv } from "@gitpod/sdk";
  import { UpdatePromptRequestSchema } from "@gitpod/sdk/gitpod/v1/agent_pb";

  async function main() {
    const ona = createClientFromEnv();
    const request = create(UpdatePromptRequestSchema, {
      promptId: "<prompt-id>",
    });
    const response = await ona.services.agent.updatePrompt(request);
    console.log(response);
  }

  main().catch(console.error);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	"connectrpc.com/connect"
  	"github.com/gitpod-io/gitpod-sdk-go/sdk"
  	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
  )

  func main() {
  	ona, err := sdk.NewFromEnv()
  	if err != nil {
  		log.Fatal(err)
  	}

  	request := connect.NewRequest(&gitpodpb.UpdatePromptRequest{
  		PromptId: "<prompt-id>",
  	})
  	response, err := ona.Services.Agent.UpdatePrompt(context.Background(), request)
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(response.Msg)
  }
  ```

  ```json Request body theme={null}
  {
    "promptId": "<prompt-id>"
  }
  ```
</CodeGroup>

## Request

`gitpod.v1.UpdatePromptRequest`

| Field      | Type                                                       | Required | Description                                                     |
| ---------- | ---------------------------------------------------------- | -------- | --------------------------------------------------------------- |
| `promptId` | string                                                     | No       | The ID of the prompt to update Constraints: `string.uuid=true`. |
| `metadata` | [Metadata](#type-gitpod-v1-update-prompt-request-metadata) | No       | Metadata updates                                                |
| `spec`     | [Spec](#type-gitpod-v1-update-prompt-request-spec)         | No       | Spec updates                                                    |

## Response

`gitpod.v1.UpdatePromptResponse`

| Field    | Type                             | Required | Description |
| -------- | -------------------------------- | -------- | ----------- |
| `prompt` | [Prompt](#type-gitpod-v1-prompt) | No       |             |

## Related types

<a id="type-gitpod-v1-prompt" />

<Accordion title="Prompt">
  `gitpod.v1.Prompt`

  | Field      | Type                                              | Required | Description |
  | ---------- | ------------------------------------------------- | -------- | ----------- |
  | `id`       | string                                            | No       |             |
  | `metadata` | [PromptMetadata](#type-gitpod-v1-prompt-metadata) | No       |             |
  | `spec`     | [PromptSpec](#type-gitpod-v1-prompt-spec)         | No       |             |
</Accordion>

<a id="type-gitpod-v1-prompt-metadata" />

<Accordion title="PromptMetadata">
  `gitpod.v1.PromptMetadata`

  | Field            | Type               | Required | Description                                                                                              |
  | ---------------- | ------------------ | -------- | -------------------------------------------------------------------------------------------------------- |
  | `organizationId` | string             | No       | organization\_id is the ID of the organization that contains the prompt Constraints: `string.uuid=true`. |
  | `name`           | string             | No       | name is the human readable name of the prompt                                                            |
  | `description`    | string             | No       | description is a description of what the prompt does                                                     |
  | `creator`        | Subject            | No       | creator is the identity of the prompt creator                                                            |
  | `createdAt`      | RFC 3339 timestamp | No       |                                                                                                          |
  | `updatedAt`      | RFC 3339 timestamp | No       |                                                                                                          |
</Accordion>

<a id="type-gitpod-v1-prompt-spec" />

<Accordion title="PromptSpec">
  `gitpod.v1.PromptSpec`

  | Field        | Type    | Required | Description                                                                                                                     |
  | ------------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
  | `prompt`     | string  | No       | prompt is the content of the prompt Constraints: `string.max_len=20000`.                                                        |
  | `isTemplate` | boolean | No       | is\_template indicates if this prompt is a template                                                                             |
  | `isCommand`  | boolean | No       | is\_command indicates if this prompt is a command                                                                               |
  | `command`    | string  | No       | command is the unique command string within the organization Constraints: `string.max_len=50, string.pattern=^[a-zA-Z0-9_-]*$`. |
  | `isSkill`    | boolean | No       | is\_skill indicates if this prompt is a skill (workflow instructions for agents)                                                |
</Accordion>

<a id="type-gitpod-v1-update-prompt-request-metadata" />

<Accordion title="Metadata">
  `gitpod.v1.UpdatePromptRequest.Metadata`

  | Field         | Type   | Required | Description                                                                                |
  | ------------- | ------ | -------- | ------------------------------------------------------------------------------------------ |
  | `name`        | string | No       | The name of the prompt Constraints: `string.max_len=255`.                                  |
  | `description` | string | No       | A description of what the prompt does Constraints: `string.max_len=500, string.min_len=1`. |
</Accordion>

<a id="type-gitpod-v1-update-prompt-request-spec" />

<Accordion title="Spec">
  `gitpod.v1.UpdatePromptRequest.Spec`

  | Field        | Type    | Required | Description                                                                                                        |
  | ------------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
  | `prompt`     | string  | No       | The prompt content Constraints: `string.max_len=20000`.                                                            |
  | `isTemplate` | boolean | No       | Whether this prompt is a template                                                                                  |
  | `isCommand`  | boolean | No       | Whether this prompt is a command                                                                                   |
  | `command`    | string  | No       | The command string (unique within organization) Constraints: `string.max_len=50, string.pattern=^[a-zA-Z0-9_-]*$`. |
  | `isSkill`    | boolean | No       | Whether this prompt is a skill                                                                                     |
</Accordion>
