### Curl Example for Signal With Start Workflow Execution Source: https://context7.com/temporalio/api/llms.txt Example using curl to signal a workflow and start it if it doesn't exist. Specifies workflow type, task queue, and conflict policy. ```bash curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/signal-with-start/approve-order" \ -H "Content-Type: application/json" \ -d '{ "workflowType": {"name": "OrderWorkflow"}, "taskQueue": {"name": "orders"}, "signalInput": {"payloads": [{"data": "eyJhcHByb3ZlZEJ5IjoiYm9iIn0="}]}, "workflowIdConflictPolicy": "WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING" }' # Response: {"runId": "...", "started": false} ``` -------------------------------- ### Get System Info Example Source: https://context7.com/temporalio/api/llms.txt Fetches system-level information about the Temporal server, including its version and feature capabilities like signal and query header support. This helps in determining server compatibility and features. ```bash curl http://localhost:7233/api/v1/system-info # Response: {"serverVersion": "1.25.0", "capabilities": {"signalAndQueryHeader": true, ...}} ``` -------------------------------- ### Manage Standalone Activities with cURL Source: https://context7.com/temporalio/api/llms.txt Examples demonstrating how to start, pause, and reset standalone activities using cURL. Pay attention to the specific endpoint and JSON payload for each operation. ```bash # Start a standalone activity curl -X POST http://localhost:7233/api/v1/namespaces/my-app/activities/send-email-001 \ -H "Content-Type: application/json" \ -d '{ "activityType": {"name": "SendEmailActivity"}, "taskQueue": {"name": "emails"}, "input": {"payloads": [{"data": "eyJ0byI6InVzZXJAZXhhbXBsZS5jb20ifQ=="}]}, "scheduleToCloseTimeout": "300s" }' ``` ```bash # Pause a workflow activity by workflow + activity ID curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/activities/charge-card/pause" \ -H "Content-Type: application/json" -d '{}' ``` ```bash # Reset a standalone activity (clears attempt count and schedules immediately) curl -X POST http://localhost:7233/api/v1/namespaces/my-app/activities/send-email-001/reset \ -H "Content-Type: application/json" \ -d '{"resetHeartbeats": true, "keepPaused": false}' ``` -------------------------------- ### Start Workflow Execution REST Example Source: https://context7.com/temporalio/api/llms.txt Example of starting a workflow execution via REST API. This POST request specifies workflow details, task queue, input, and retry policy. The response includes the run ID. ```bash curl -X POST http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234 \ -H "Content-Type: application/json" \ -d '{ "workflowType": {"name": "OrderWorkflow"}, "taskQueue": {"name": "orders"}, "input": {"payloads": [{"data": "eyJvcmRlcklkIjoiMTIzNCJ9"}]}, "workflowExecutionTimeout": "3600s", "workflowIdReusePolicy": "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE", "retryPolicy": { "initialInterval": "1s", "backoffCoefficient": 2.0, "maximumAttempts": 3 } }' # Response: {"runId": "a1b2c3d4-...", "started": true} ``` -------------------------------- ### Get Cluster Info Example Source: https://context7.com/temporalio/api/llms.txt Retrieves metadata about the Temporal cluster, including supported client versions, server version, and cluster ID. This is useful for understanding the cluster's capabilities and configuration. ```bash curl http://localhost:7233/api/v1/cluster-info # Response: {"supportedClients": {...}, "serverVersion": "1.25.0", "clusterId": "...", ...} ``` -------------------------------- ### Priority JSON Example Source: https://context7.com/temporalio/api/llms.txt An example of a `Priority` message in JSON format, demonstrating how to set a high priority key, a specific fairness key for a tenant, and a custom fairness weight. ```json { "priorityKey": 1, "fairnessKey": "premium-tenant", "fairnessWeight": 5.0 } ``` -------------------------------- ### Curl Example for Get Workflow Execution History Source: https://context7.com/temporalio/api/llms.txt Example using curl to fetch the history of a workflow execution. Specifies a maximum page size. ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/history?maximumPageSize=100" # Response: {"history": {"events": [...]}, "nextPageToken": "...", "archived": false} ``` -------------------------------- ### Curl Example for Query Workflow Source: https://context7.com/temporalio/api/llms.txt Example using curl to query the status of a workflow execution. Specifies execution details and the query type. ```bash curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/query/getStatus" \ -H "Content-Type: application/json" \ -d '{ "execution": {"workflowId": "order-1234"}, "query": {"queryType": "getStatus"} }' # Response: {"queryResult": {"payloads": [{"data": "InBlbmRpbmcgYXBwcm92YWwiIn0="}]}} ``` -------------------------------- ### Register Namespace REST Example Source: https://context7.com/temporalio/api/llms.txt Example of how to register a new namespace using the Temporal API via a REST POST request. Requires Content-Type header and a JSON payload with namespace details. ```bash # REST example curl -X POST http://localhost:7233/api/v1/namespaces \ -H "Content-Type: application/json" \ -d '{ "namespace": "my-app", "description": "Production namespace for my-app", "ownerEmail": "team@example.com", "workflowExecutionRetentionPeriod": "604800s", "isGlobalNamespace": false }' # Response: {} ``` -------------------------------- ### Curl Example for Signal Workflow Execution Source: https://context7.com/temporalio/api/llms.txt Example using curl to signal a workflow execution. Includes workflow execution ID, signal name, and payload. ```bash curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/signal/approve-order" \ -H "Content-Type: application/json" \ -d '{ "workflowExecution": {"workflowId": "order-1234"}, "input": {"payloads": [{"data": "eyJhcHByb3ZlZEJ5IjoiYWxpY2UifQ=="}]} }' # Response: {} ``` -------------------------------- ### Start a Nexus Operation Source: https://context7.com/temporalio/api/llms.txt Initiates a Nexus operation. Requires endpoint, service, operation details, and optional timeouts. ```bash # Start a Nexus operation curl -X POST http://localhost:7233/api/v1/namespaces/my-app/nexus-operations/nexus-op-001 \ -H "Content-Type: application/json" \ -d '{ "endpoint": "payment-service", "service": "PaymentService", "operation": "ChargeCard", "input": {"payloads": [{"data": "eyJhbW91bnQiOjk5fQ=="}]}, "scheduleToCloseTimeout": "600s" }' ``` -------------------------------- ### Signal With Start Workflow Execution Source: https://context7.com/temporalio/api/llms.txt Atomically starts a workflow if it's not running, then signals it. If already running, it only signals. This prevents signal loss. ```proto rpc SignalWithStartWorkflowExecution (SignalWithStartWorkflowExecutionRequest) returns (SignalWithStartWorkflowExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/workflows/{workflow_id}/signal-with-start/{signal_name} ``` -------------------------------- ### List Clusters using Go gRPC Client Source: https://context7.com/temporalio/api/llms.txt Example of using the Go gRPC client to list available clusters. It iterates through the response to print cluster details. ```go // Go gRPC client example operatorClient := operatorservice.NewOperatorServiceClient(conn) resp, err := operatorClient.ListClusters(ctx, &operatorservice.ListClustersRequest{PageSize: 10}) for _, cluster := range resp.Clusters { fmt.Printf("Cluster: %s, Address: %s\n", cluster.ClusterName, cluster.ClusterAddress) } ``` -------------------------------- ### Trigger Workflow Rule Example Source: https://context7.com/temporalio/api/llms.txt This example demonstrates how to manually trigger a previously defined workflow rule against a specific workflow execution. It requires the workflow ID and the rule ID. ```bash # One-off trigger against a specific workflow curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/trigger-rule" \ -H "Content-Type: application/json" \ -d '{"ruleId": "max-2h-runtime"}' ``` -------------------------------- ### Example RetryPolicy JSON Source: https://context7.com/temporalio/api/llms.txt Provides an example of a `RetryPolicy` configuration in JSON format, specifying initial and maximum intervals, backoff coefficient, maximum attempts, and non-retryable error types. ```json { "initialInterval": "1s", "backoffCoefficient": 2.0, "maximumInterval": "60s", "maximumAttempts": 5, "nonRetryableErrorTypes": ["InvalidInputError", "AuthorizationError"] } ``` -------------------------------- ### Failure JSON Example Source: https://context7.com/temporalio/api/llms.txt An example of how a `Failure` message, specifically an `ApplicationFailureInfo`, might be represented in JSON format. This is useful for debugging and integration testing. ```json { "message": "payment declined", "source": "GoSDK", "applicationFailureInfo": { "type": "PaymentDeclinedError", "nonRetryable": true, "details": {"payloads": [{"data": "eyJjb2RlIjoiSU5TVUZGSUNJRU5UX0ZVTkRTIn0="}]} } } ``` -------------------------------- ### Start Workflow Execution gRPC Definition Source: https://context7.com/temporalio/api/llms.txt Defines the gRPC method and request message for starting a new workflow execution. Includes parameters for workflow ID, type, task queue, input, timeouts, and retry policies. ```proto rpc StartWorkflowExecution (StartWorkflowExecutionRequest) returns (StartWorkflowExecutionResponse); message StartWorkflowExecutionRequest { string namespace = 1; string workflow_id = 2; temporal.api.common.v1.WorkflowType workflow_type = 3; temporal.api.taskqueue.v1.TaskQueue task_queue = 4; temporal.api.common.v1.Payloads input = 5; google.protobuf.Duration workflow_execution_timeout = 6; google.protobuf.Duration workflow_run_timeout = 7; google.protobuf.Duration workflow_task_timeout = 8; string identity = 9; string request_id = 10; temporal.api.enums.v1.WorkflowIdReusePolicy workflow_id_reuse_policy = 11; temporal.api.common.v1.RetryPolicy retry_policy = 14; string cron_schedule = 15; temporal.api.common.v1.Memo memo = 16; temporal.api.common.v1.SearchAttributes search_attributes = 17; temporal.api.enums.v1.WorkflowIdConflictPolicy workflow_id_conflict_policy = 22; temporal.api.common.v1.Priority priority = 27; } message StartWorkflowExecutionResponse { string run_id = 1; bool started = 2; // false if an existing execution was reused } ``` -------------------------------- ### StartWorkflowExecution Source: https://context7.com/temporalio/api/llms.txt Starts a new workflow execution. Creates a `WORKFLOW_EXECUTION_STARTED` event in the workflow history and schedules the first workflow task. ```APIDOC ## StartWorkflowExecution ### Description Starts a new workflow execution. Creates a `WORKFLOW_EXECUTION_STARTED` event in the workflow history and schedules the first workflow task. Returns `WorkflowExecutionAlreadyStartedFailure` if an instance already exists with the same workflow ID (configurable via `workflow_id_conflict_policy`). ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/workflows/{workflow_id} ### Parameters #### Path Parameters - **namespace** (string) - Required - The namespace where the workflow will be started. - **workflow_id** (string) - Required - The unique identifier for the workflow execution. #### Request Body - **workflow_type** (temporal.api.common.v1.WorkflowType) - Required - The type of the workflow to start. - **task_queue** (temporal.api.taskqueue.v1.TaskQueue) - Required - The task queue to which the workflow tasks will be dispatched. - **input** (temporal.api.common.v1.Payloads) - Optional - The input arguments for the workflow. - **workflow_execution_timeout** (google.protobuf.Duration) - Optional - The total timeout for the workflow execution. - **workflow_run_timeout** (google.protobuf.Duration) - Optional - The timeout for a single run of the workflow. - **workflow_task_timeout** (google.protobuf.Duration) - Optional - The timeout for each workflow task. - **identity** (string) - Optional - The identity of the client starting the workflow. - **request_id** (string) - Optional - A unique ID for the request, used for idempotency. - **workflow_id_reuse_policy** (temporal.api.enums.v1.WorkflowIdReusePolicy) - Optional - Policy for reusing workflow IDs. - **retry_policy** (temporal.api.common.v1.RetryPolicy) - Optional - The retry policy for the workflow. - **cron_schedule** (string) - Optional - A cron schedule for recurring workflow executions. - **memo** (temporal.api.common.v1.Memo) - Optional - Memo data associated with the workflow. - **search_attributes** (temporal.api.common.v1.SearchAttributes) - Optional - Search attributes for the workflow. - **workflow_id_conflict_policy** (temporal.api.enums.v1.WorkflowIdConflictPolicy) - Optional - Policy for handling workflow ID conflicts. - **priority** (temporal.api.common.v1.Priority) - Optional - The priority of the workflow. ### Request Example ```json { "workflowType": {"name": "OrderWorkflow"}, "taskQueue": {"name": "orders"}, "input": {"payloads": [{"data": "eyJvcmRlcklkIjoiMTIzNCJ9"}]}, "workflowExecutionTimeout": "3600s", "workflowIdReusePolicy": "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE", "retryPolicy": { "initialInterval": "1s", "backoffCoefficient": 2.0, "maximumAttempts": 3 } } ``` ### Response #### Success Response (200) - **run_id** (string) - The ID of the newly started workflow run. - **started** (boolean) - Indicates if a new execution was started (false if an existing execution was reused). #### Response Example ```json { "runId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "started": true } ``` ``` -------------------------------- ### Buf CLI Commands for Code Generation and Linting Source: https://context7.com/temporalio/api/llms.txt Commands to install the Buf CLI, update dependencies, generate code, and perform linting and breaking change checks against the Temporal API. ```bash # Install buf CLI and generate code brew install bufbuild/buf/buf buf dep update buf generate # Lint and check for breaking changes buf lint buf breaking --against '.git#branch=main' ``` -------------------------------- ### Register Custom Search Attribute Example Source: https://context7.com/temporalio/api/llms.txt This example shows how to register a custom search attribute for workflow visibility queries using the Temporal CLI. It specifies the attribute name and its type. The REST API equivalent is also noted. ```bash # Register a custom search attribute "OrderStatus" of type keyword # (gRPC via Temporal CLI) temporal operator search-attribute create --name OrderStatus --type Keyword --namespace my-app ``` -------------------------------- ### Describe Workflow Execution Source: https://context7.com/temporalio/api/llms.txt Returns detailed information about a specific workflow execution. Supports REST GET requests. ```proto rpc DescribeWorkflowExecution (DescribeWorkflowExecutionRequest) returns (DescribeWorkflowExecutionResponse); // REST: GET /api/v1/namespaces/{namespace}/workflows/{execution.workflow_id} ``` ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234" # Response: {"executionConfig": {...}, "workflowExecutionInfo": {...}, "pendingActivities": [...]} ``` -------------------------------- ### Create Workflow Rule Example Source: https://context7.com/temporalio/api/llms.txt Use this to create a namespace-scoped rule for automating workflow actions based on specific criteria, such as execution timeout. Requires a JSON payload with rule details. ```bash # Create a rule: auto-cancel workflows running over 2 hours curl -X POST http://localhost:7233/api/v1/namespaces/my-app/workflow-rules \ -H "Content-Type: application/json" \ -d '{ "rule": { "ruleId": "max-2h-runtime", "spec": {"executionTimeout": "7200s"}, "action": {"terminateWorkflow": {"reason": "exceeded max runtime"}} } }' ``` -------------------------------- ### List Search Attributes Example Source: https://context7.com/temporalio/api/llms.txt Retrieves a list of all custom and system search attributes available in a given namespace. This is useful for understanding what fields can be used for workflow visibility queries. The response includes custom and system attributes. ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/search-attributes" # Response: {"customAttributes": {"OrderStatus": "INDEXED_VALUE_TYPE_KEYWORD"}, "systemAttributes": {...}} ``` -------------------------------- ### Example JSON Payload Source: https://context7.com/temporalio/api/llms.txt Illustrates the structure of a JSON payload, showing base64 encoded data and metadata indicating the encoding type. ```json // Example JSON Payload (base64 data field) { "payloads": [{ "metadata": {"encoding": "anNvbi9wbGFpbg=="}, "data": "eyJvcmRlcklkIjoiMTIzNCIsImFtb3VudCI6OTl9" }] } ``` -------------------------------- ### Standalone Activity Management APIs Source: https://context7.com/temporalio/api/llms.txt gRPC definitions for managing standalone activity executions independently of a parent workflow. These cover starting, describing, pausing, resetting, and more. ```proto rpc StartActivityExecution (StartActivityExecutionRequest) returns (StartActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id} ``` ```proto rpc DescribeActivityExecution (DescribeActivityExecutionRequest) returns (DescribeActivityExecutionResponse); // REST: GET /api/v1/namespaces/{namespace}/activities/{activity_id} ``` ```proto rpc PauseActivityExecution (PauseActivityExecutionRequest) returns (PauseActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id}/pause // POST /api/v1/namespaces/{namespace}/workflows/{workflow_id}/activities/{activity_id}/pause ``` ```proto rpc ResetActivityExecution (ResetActivityExecutionRequest) returns (ResetActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id}/reset ``` ```proto rpc UnpauseActivityExecution (UnpauseActivityExecutionRequest) returns (UnpauseActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id}/unpause ``` ```proto rpc RequestCancelActivityExecution (RequestCancelActivityExecutionRequest) returns (RequestCancelActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id}/cancel ``` ```proto rpc TerminateActivityExecution (TerminateActivityExecutionRequest) returns (TerminateActivityExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/activities/{activity_id}/terminate ``` ```proto rpc ListActivityExecutions (ListActivityExecutionsRequest) returns (ListActivityExecutionsResponse); // REST: GET /api/v1/namespaces/{namespace}/activities ``` -------------------------------- ### Get Worker Versioning Rules Source: https://context7.com/temporalio/api/llms.txt Retrieves the worker versioning rules for a specific task queue. This includes assignment and redirect rules. ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/task-queues/orders/worker-versioning-rules" # Response: {"assignmentRules": [...], "compatibleRedirectRules": [...], "conflictToken": "..."} ``` -------------------------------- ### SignalWithStartWorkflowExecution Source: https://context7.com/temporalio/api/llms.txt Atomically starts a workflow if it is not currently running, and then signals it. If the workflow is already running, it only signals it. This ensures that signals are never lost, regardless of the workflow's state. ```APIDOC ## POST /api/v1/namespaces/{namespace}/workflows/{workflow_id}/signal-with-start/{signal_name} ### Description Atomically starts a workflow if not running, then signals it. If running, only signals it. Ensures a signal is never lost regardless of workflow state. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/workflows/{workflow_id}/signal-with-start/{signal_name} ### Parameters #### Path Parameters - **namespace** (string) - Required - The namespace of the workflow. - **workflow_id** (string) - Required - The ID of the workflow to signal or start and signal. - **signal_name** (string) - Required - The name of the signal to send. #### Request Body - **workflowType** (object) - Required - Specifies the type of the workflow to start if it doesn't exist. - **name** (string) - Required - The name of the workflow type. - **taskQueue** (object) - Required - The task queue to use for the workflow. - **name** (string) - Required - The name of the task queue. - **signalInput** (temporal.api.common.v1.Payloads) - Optional - The input payload for the signal. - **workflowIdConflictPolicy** (temporal.api.enums.v1.WorkflowIdConflictPolicy) - Optional - Policy to handle workflow ID conflicts. Defaults to `WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING`. - **workflowRunTimeout** (temporal.Duration) - Optional - The maximum duration for the workflow run. - **workflowExecutionTimeout** (temporal.Duration) - Optional - The maximum duration for the workflow execution. - **workflowTaskTimeout** (temporal.Duration) - Optional - The maximum duration for a workflow task. - **retryPolicy** (temporal.api.failure.v1.RetryPolicy) - Optional - The retry policy for the workflow. - **cronSchedule** (string) - Optional - The cron schedule for the workflow. - **memo** (temporal.api.memo.v1.Memo) - Optional - Memo data for the workflow. - **searchAttributes** (temporal.api.searchattributes.v1.SearchAttributes) - Optional - Search attributes for the workflow. - **header** (repeated temporal.api.common.v1.Header) - Optional - Custom headers for the request. - **identity** (string) - Optional - The identity of the caller. - **request_id** (string) - Optional - Unique identifier for the request. - **signalName** (string) - Required if `signalInput` is provided - The name of the signal to send. - **signalInput** (temporal.api.common.v1.Payloads) - Optional - The input for the signal. ### Request Example ```bash curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/signal-with-start/approve-order" \ -H "Content-Type: application/json" \ -d '{ "workflowType": {"name": "OrderWorkflow"}, "taskQueue": {"name": "orders"}, "signalInput": {"payloads": [{"data": "eyJhcHByb3ZlZEJ5IjoiYm9iIn0="}]}, "workflowIdConflictPolicy": "WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING" }' ``` ### Response #### Success Response (200) - **runId** (string) - The ID of the workflow run. - **started** (bool) - Indicates if the workflow was started by this call. ``` -------------------------------- ### Standalone Activity APIs Source: https://context7.com/temporalio/api/llms.txt Manage activity executions that run independently of a parent workflow, including starting, describing, cancelling, terminating, pausing, and resetting them by `activity_id`. ```APIDOC ## StartActivityExecution ### Description Starts a standalone activity execution. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id} ### Request Body - **activityType** (object) - Required - The type of the activity. - **name** (string) - Required - The name of the activity. - **taskQueue** (object) - Required - The task queue to which the activity is dispatched. - **name** (string) - Required - The name of the task queue. - **input** (object) - Optional - The input for the activity. - **payloads** (array) - Optional - An array of payloads for the input. - **data** (string) - Optional - The data of the payload. - **scheduleToCloseTimeout** (string) - Optional - The timeout for the activity to close. ### Request Example ```json { "activityType": {"name": "SendEmailActivity"}, "taskQueue": {"name": "emails"}, "input": {"payloads": [{"data": "eyJ0byI6InVzZXJAZXhhbXBsZS5jb20ifQ=="}]}, "scheduleToCloseTimeout": "300s" } ``` ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## DescribeActivityExecution ### Description Describes a standalone activity execution. ### Method GET ### Endpoint GET /api/v1/namespaces/{namespace}/activities/{activity_id} ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## PauseActivityExecution ### Description Pauses a standalone activity execution. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id}/pause POST /api/v1/namespaces/{namespace}/workflows/{workflow_id}/activities/{activity_id}/pause ### Request Body (No specific fields mentioned in the source, empty JSON object used in example) ### Request Example ```json {} ``` ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## ResetActivityExecution ### Description Resets a standalone activity execution, clearing attempt count and scheduling it immediately. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id}/reset ### Request Body - **resetHeartbeats** (boolean) - Optional - Whether to reset heartbeats. - **keepPaused** (boolean) - Optional - Whether to keep the activity paused. ### Request Example ```json { "resetHeartbeats": true, "keepPaused": false } ``` ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## UnpauseActivityExecution ### Description Unpauses a standalone activity execution. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id}/unpause ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## RequestCancelActivityExecution ### Description Requests cancellation of a standalone activity execution. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id}/cancel ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## TerminateActivityExecution ### Description Terminates a standalone activity execution. ### Method POST ### Endpoint POST /api/v1/namespaces/{namespace}/activities/{activity_id}/terminate ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` ```APIDOC ## ListActivityExecutions ### Description Lists standalone activity executions. ### Method GET ### Endpoint GET /api/v1/namespaces/{namespace}/activities ### Response #### Success Response (200) (No specific fields mentioned in the source) ``` -------------------------------- ### Control Workflow Execution with cURL Source: https://context7.com/temporalio/api/llms.txt Examples for pausing and unpausing workflow executions using cURL. Ensure the correct content type and JSON payload are provided. ```bash curl -X POST http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/pause \ -H "Content-Type: application/json" \ -d '{"identity": "ops-engineer"}' ``` ```bash curl -X POST http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/unpause \ -H "Content-Type: application/json" \ -d '{"identity": "ops-engineer"}' ``` -------------------------------- ### Schedule Management (CRUD) Source: https://context7.com/temporalio/api/llms.txt Provides full CRUD operations for Temporal Schedules, which are cron-like and interval-based triggers that automatically start workflow executions on a configurable cadence. ```APIDOC ## CreateSchedule ### Description Creates a new Temporal Schedule. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/schedules/{schedule_id} ### Parameters #### Path Parameters - **namespace** (string) - Required - The namespace for the schedule. - **schedule_id** (string) - Required - The unique identifier for the schedule. #### Request Body - **schedule** (object) - The schedule definition, including spec, action, and policies. - **identity** (string) - Optional - The identity of the caller. ### Request Example ```json { "schedule": { "spec": { "structuredCalendar": [{"hour": [{"start": 8, "end": 8}], "minute": [{"start": 0, "end": 0}]}], "timezone": "UTC" }, "action": { "startWorkflow": { "workflowType": {"name": "DailyReportWorkflow"}, "taskQueue": {"name": "reports"}, "workflowExecutionTimeout": "3600s" } }, "policies": { "overlapPolicy": "SCHEDULE_OVERLAP_POLICY_SKIP" } }, "identity": "admin-cli" } ``` ``` ```APIDOC ## DescribeSchedule ### Description Retrieves details of a specific Temporal Schedule. ### Method GET ### Endpoint /api/v1/namespaces/{namespace}/schedules/{schedule_id} ``` ```APIDOC ## UpdateSchedule ### Description Updates an existing Temporal Schedule. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/schedules/{schedule_id}/update ``` ```APIDOC ## PatchSchedule ### Description Partially updates an existing Temporal Schedule. Used here to trigger immediately. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/schedules/{schedule_id}/patch ### Parameters #### Request Body - **triggerImmediately** (object) - Specifies to trigger the schedule immediately. - **overlapPolicy** (string) - Optional - The overlap policy for immediate triggers. ``` ```APIDOC ## DeleteSchedule ### Description Deletes a Temporal Schedule. ### Method DELETE ### Endpoint /api/v1/namespaces/{namespace}/schedules/{schedule_id} ``` ```APIDOC ## ListSchedules ### Description Lists all Temporal Schedules within a namespace. ### Method GET ### Endpoint /api/v1/namespaces/{namespace}/schedules ``` -------------------------------- ### List Workers Example Source: https://context7.com/temporalio/api/llms.txt Fetches a list of active workers within a namespace, including their identity, task queues, and last heartbeat time. Useful for monitoring worker status. The response is a JSON object containing a list of workers. ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/workers?pageSize=20" # Response: {"workers": [{"identity": "worker-1@host", "taskQueues": [...], "lastHeartbeatTime": "..."}], ...} ``` -------------------------------- ### Create Nexus Endpoint Source: https://context7.com/temporalio/api/llms.txt Creates a Nexus endpoint that routes to a Temporal task queue. Requires specifying the endpoint name, description, and target worker details. ```bash # Create a Nexus endpoint routing to a Temporal task queue curl -X POST http://localhost:7233/api/v1/nexus/endpoints \ -H "Content-Type: application/json" \ -d '{ "spec": { "name": "payment-service", "description": {"payloads": [{"data": "UGF5bWVudCBTZXJ2aWNl"}]}, "target": { "worker": { "namespace": "payments", "taskQueue": "payment-tasks" } } } }' # Response: {"endpoint": {"id": "ep-abc123", "version": 1, "spec": {...}}} ``` -------------------------------- ### Count Workflow Executions Source: https://context7.com/temporalio/api/llms.txt Returns the count of workflow executions matching a visibility query. Supports REST GET requests. ```proto rpc CountWorkflowExecutions (CountWorkflowExecutionsRequest) returns (CountWorkflowExecutionsResponse); // REST: GET /api/v1/namespaces/{namespace}/workflow-count ``` ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/workflow-count?query=WorkflowType%3D%22OrderWorkflow%22+AND+ExecutionStatus%3D%22Running%22" # Response: {"count": "42", "groups": []} ``` -------------------------------- ### Buf Configuration for API Dependency Source: https://context7.com/temporalio/api/llms.txt Configuration for a project using the Temporal API as a dependency via Buf. This includes specifying the dependency in `buf.yaml` and setting up plugins for Go code generation in `buf.gen.yaml`. ```yaml # buf.yaml — consuming project version: v1 deps: - buf.build/temporalio/api # buf.gen.yaml — Go code generation example version: v1 plugins: - plugin: buf.build/protocolbuffers/go out: gen/go opt: paths=source_relative - plugin: buf.build/grpc/go out: gen/go opt: paths=source_relative ``` -------------------------------- ### Get Workflow Execution History Source: https://context7.com/temporalio/api/llms.txt Retrieves the complete event history for a workflow. Supports long-polling for new events on running workflows. ```proto rpc GetWorkflowExecutionHistory (GetWorkflowExecutionHistoryRequest) returns (GetWorkflowExecutionHistoryResponse); // REST: GET /api/v1/namespaces/{namespace}/workflows/{execution.workflow_id}/history message GetWorkflowExecutionHistoryRequest { string namespace = 1; temporal.api.common.v1.WorkflowExecution execution = 2; int32 maximum_page_size = 3; bytes next_page_token = 4; bool wait_new_event = 5; // long-poll for new events temporal.api.enums.v1.HistoryEventFilterType history_event_filter_type = 6; bool skip_archival = 7; } ``` -------------------------------- ### ResetWorkflowExecution Source: https://context7.com/temporalio/api/llms.txt Resets an existing workflow execution to a specified past WORKFLOW_TASK_COMPLETED event. Immediately terminates the current run and starts replay from the reset point. ```APIDOC ## ResetWorkflowExecution ### Description Resets an existing workflow execution to a specified past `WORKFLOW_TASK_COMPLETED` event. Immediately terminates the current run and starts replay from the reset point. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/reset ### Parameters #### Path Parameters - **namespace** (string) - Required - The namespace of the workflow. - **workflow_execution.workflow_id** (string) - Required - The ID of the workflow execution. #### Request Body - **namespace** (string) - Required - The namespace of the workflow. - **workflow_execution** (object) - Required - The workflow execution to reset. - **workflowId** (string) - Required - The ID of the workflow execution. - **runId** (string) - Required - The ID of the specific run. - **reason** (string) - Optional - The reason for the reset. - **workflowTaskFinishEventId** (integer) - Required - The exclusive reset point (a `WORKFLOW_TASK_COMPLETED` event ID). - **requestId** (string) - Optional - A unique identifier for the reset request. - **resetReapplyExcludeTypes** (array) - Optional - Types of events to exclude from reapplying during reset. - **resetReapplyExcludeTypes** (string) - The type of event to exclude (e.g., `RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL`). ### Request Example ```json { "workflowExecution": {"workflowId": "order-1234", "runId": "a1b2..."}, "reason": "fixing bug introduced in deploy-42", "workflowTaskFinishEventId": 15, "resetReapplyExcludeTypes": ["RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL"] } ``` ### Response #### Success Response (200) - **runId** (string) - The ID of the new run created after the reset. #### Response Example ```json {"runId": "new-run-id-..."} ``` ``` -------------------------------- ### Describe Task Queue Source: https://context7.com/temporalio/api/llms.txt Retrieve information about a task queue, including build ID breakdowns, active pollers, workflow reachability, and backlog counts. ```proto rpc DescribeTaskQueue (DescribeTaskQueueRequest) returns (DescribeTaskQueueResponse); // REST: GET /api/v1/namespaces/{namespace}/task-queues/{task_queue.name} ``` ```bash curl "http://localhost:7233/api/v1/namespaces/my-app/task-queues/orders" # Response: {"pollers": [...], "taskQueueStatus": {...}, "versionInfo": {...}} ``` -------------------------------- ### Worker Deployment APIs Source: https://context7.com/temporalio/api/llms.txt Experimental APIs for managing versioned worker deployments, controlling current versions, and ramping traffic to new versions. ```APIDOC ## DescribeWorkerDeployment ### Description Describes a worker deployment. ### Method GET ### Endpoint /api/v1/namespaces/{namespace}/worker-deployments/{deployment_name} ``` ```APIDOC ## SetWorkerDeploymentCurrentVersion ### Description Sets the current version for a worker deployment. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}/set-current-version ### Request Body - **version** (object) - Required - The version to set as current. - **deploymentName** (string) - Required - The name of the deployment. - **buildId** (string) - Required - The build ID of the version. ### Request Example ```json { "version": {"deploymentName": "order-workers", "buildId": "v2.1.0"} } ``` ``` ```APIDOC ## SetWorkerDeploymentRampingVersion ### Description Sets a ramping version for a worker deployment, gradually directing traffic to a new version. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}/set-ramping-version ### Request Body - **version** (object) - Required - The version to ramp traffic to. - **deploymentName** (string) - Required - The name of the deployment. - **buildId** (string) - Required - The build ID of the version. - **rampingPercentage** (number) - Required - The percentage of traffic to ramp. ### Request Example ```json { "version": {"deploymentName": "order-workers", "buildId": "v2.2.0"}, "rampingPercentage": 10.0 } ``` ``` ```APIDOC ## ListWorkerDeployments ### Description Lists worker deployments. ### Method GET ### Endpoint /api/v1/namespaces/{namespace}/worker-deployments ``` ```APIDOC ## CreateWorkerDeployment ### Description Creates a worker deployment. ### Method POST ### Endpoint /api/v1/namespaces/{namespace}/worker-deployments/{deployment_name} ``` -------------------------------- ### Promote Worker Deployment Version Source: https://context7.com/temporalio/api/llms.txt Sets a specific build ID as the current version for a worker deployment. Used to make a new version live immediately. ```bash # Promote build v2.1.0 to current for the "order-workers" deployment curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/worker-deployments/order-workers/set-current-version" \ -H "Content-Type: application/json" \ -d '{"version": {"deploymentName": "order-workers", "buildId": "v2.1.0"}}' ``` -------------------------------- ### Query Workflow Source: https://context7.com/temporalio/api/llms.txt Executes a synchronous query against workflow state. The query is handled by a worker and the result is returned. ```proto rpc QueryWorkflow (QueryWorkflowRequest) returns (QueryWorkflowResponse); // REST: POST /api/v1/namespaces/{namespace}/workflows/{execution.workflow_id}/query/{query.query_type} message QueryWorkflowRequest { string namespace = 1; temporal.api.common.v1.WorkflowExecution execution = 2; temporal.api.query.v1.WorkflowQuery query = 3; temporal.api.enums.v1.QueryRejectCondition query_reject_condition = 4; } ``` -------------------------------- ### List Nexus Endpoints Source: https://context7.com/temporalio/api/llms.txt Retrieves a list of Nexus endpoints. Pagination is supported via `nextPageToken` in the response. ```bash curl "http://localhost:7233/api/v1/nexus/endpoints" # Response: {"endpoints": [...], "nextPageToken": "..."} ``` -------------------------------- ### Reset Workflow Execution Source: https://context7.com/temporalio/api/llms.txt Resets an existing workflow execution to a specified past `WORKFLOW_TASK_COMPLETED` event. This immediately terminates the current run and starts replay from the reset point. Use this to recover from specific error states. ```proto rpc ResetWorkflowExecution (ResetWorkflowExecutionRequest) returns (ResetWorkflowExecutionResponse); // REST: POST /api/v1/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/reset message ResetWorkflowExecutionRequest { string namespace = 1; temporal.api.common.v1.WorkflowExecution workflow_execution = 2; string reason = 3; int64 workflow_task_finish_event_id = 4; // exclusive reset point string request_id = 5; temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6 [deprecated = true]; repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 8; } ``` ```bash curl -X POST \ "http://localhost:7233/api/v1/namespaces/my-app/workflows/order-1234/reset" \ -H "Content-Type: application/json" \ -d '{ "workflowExecution": {"workflowId": "order-1234", "runId": "a1b2..."}, "reason": "fixing bug introduced in deploy-42", "workflowTaskFinishEventId": 15, "resetReapplyExcludeTypes": ["RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL"] }' # Response: {"runId": "new-run-id-..."} ``` -------------------------------- ### Manage Batch Operations Source: https://context7.com/temporalio/api/llms.txt Initiate, monitor, and manage batch operations for bulk actions like terminate, cancel, signal, reset, or delete on multiple workflows. ```proto rpc StartBatchOperation(StartBatchOperationRequest) returns (StartBatchOperationResponse); // REST: POST /api/v1/namespaces/{namespace}/batch-operations/{job_id} rpc DescribeBatchOperation(DescribeBatchOperationRequest) returns (DescribeBatchOperationResponse); // REST: GET /api/v1/namespaces/{namespace}/batch-operations/{job_id} ``` ```bash # Terminate all failed order workflows curl -X POST http://localhost:7233/api/v1/namespaces/my-app/batch-operations/batch-20240101 \ -H "Content-Type: application/json" \ -d '{ "visibilityQuery": "WorkflowType=\"OrderWorkflow\" AND ExecutionStatus=\"Failed\"", "reason": "cleanup stale failures", "terminationOperation": {} }' # Check status curl "http://localhost:7233/api/v1/namespaces/my-app/batch-operations/batch-20240101" # Response: {"operationType": "...", "state": "BATCH_OPERATION_STATE_RUNNING", "totalOperationCount": "142", ...} ``` -------------------------------- ### List Workflow Executions Source: https://context7.com/temporalio/api/llms.txt Visibility API to list workflow executions matching a SQL-like query string. Use this for searching workflows based on custom search attributes and standard fields. Supports pagination. ```proto rpc ListWorkflowExecutions (ListWorkflowExecutionsRequest) returns (ListWorkflowExecutionsResponse); message ListWorkflowExecutionsRequest { string namespace = 1; int32 page_size = 2; bytes next_page_token = 3; string query = 4; // SQL-like visibility query } ``` ```bash # List running order workflows from last 24h curl "http://localhost:7233/api/v1/namespaces/my-app/workflows?query=WorkflowType%3D%22OrderWorkflow%22+AND+ExecutionStatus%3D%22Running%22&pageSize=50" # Response: {"executions": [...], "nextPageToken": "..."} ```