How query the completed workflow using workflow id?

Is it possible to query the completed workflow using workflow id?

Hello @Vijay_T and welcome.

Do you have advanced visibility enabled? if you do you can use ListWorkflowExecutionsRequest, setting the query setQuery(WorkflowId="yourworkflowid" and ExecutionStatus="Completed")

ListWorkflow API supports pagination, you may want to set pageSize and do recursive calls using the page token in the following call.

Keep in mind that once your retention period is reached your closed workflows (completed and failed) will be deleted, see this related post. Running more than one instance with same workflowId in parallel - #3 by swaroop

If you don’t have advance visibility enabled you can still use ListWorkflowExecutionsRequest but the types of queries you can do are limited, i.e you can not use operators like AND Visibility | Temporal Documentation

You can query by creating a workflow stub by WorkflowID.