Creating a new namespace in Temporal

How do you do it in temporal, programmatically and from command line.



Here is the relevant CLI documentation.

Programmatically it is done through gRPC API exposed by the service.

In Java the generated gRPC client is accessible through WorkflowServiceStubs:

    WorkflowServiceStubs service =
    RegisterNamespaceRequest request =

In Go SDK you can use higher-level NamespaceClient:

	client, err := client.NewNamespaceClient(client.Options{HostPort: ts.config.ServiceAddr})
	err = client.Register(ctx, &workflowservice.RegisterNamespaceRequest{
		Name:                             name,
		WorkflowExecutionRetentionPeriod: &retention,

1 Like

Thanks a ton

1 Like

Hey Max,

I am running into an issue trying to connect to remote temporal server using grpc API as above, I am seeing Connection reset by peer and when I run from docker i am seeing the following exception

Error: Operation DescribeNamespace failed.

Error Details: last connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup xxxx:1234 on [::1]:53: read udp [::1]:45479->[::1]:53: read: connection refused”

nc to the temporal hostname:port succeeds from mac. Any ideas? do I need to set any other property for the gRpc to work?


I’m not sure how to troubleshoot connectivity issues in your environment. Try invoking health service endpoint. One option is to use curl.

I am seeing the following exception running above code to local server
RegisterNamespace.main()Exception in thread “main” io.grpc.StatusRuntimeException: UNIMPLEMENTED: unknown service temporal.workflowservice.v1.WorkflowService
at io.grpc.stub.ClientCalls.toStatusRuntimeException(
at io.grpc.stub.ClientCalls.getUnchecked(
at io.grpc.stub.ClientCalls.blockingUnaryCall(
at io.temporal.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.registerNamespace(
at io.temporal.samples.common.RegisterNamespace.main(
temporal sevrer : 0.28.0

tried with server 0.27 also did not work

I am seeing this error when I am running the basic HelloActivity examples