# Creating a new namespace in Temporal

**URL:** <https://community.temporal.io/t/creating-a-new-namespace-in-temporal/478>\
**Category:** Community Support\
**Tags:** namespace\
**Created:** [August 17, 2020, 9:51pm UTC](https://community.temporal.io/t/creating-a-new-namespace-in-temporal/478 "2020-08-17T21:51:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 18, 2020, 3:55am UTC](https://community.temporal.io/t/creating-a-new-namespace-in-temporal/478/2 "2020-08-18T03:55:34Z")

</div>

[Here is](https://docs.temporal.io/docs/tctl#namespace-operation-examples) the relevant CLI documentation.

Programmatically it is done through [gRPC API](https://github.com/temporalio/api/blob/1b9e06b811dc75f17495e06f81a07ab7de648f2e/temporal/api/workflowservice/v1/service.proto#L48) exposed by the service.

In Java the generated gRPC client is accessible through WorkflowServiceStubs:

```java
    WorkflowServiceStubs service =
        WorkflowServiceStubs.newInstance(
            WorkflowServiceStubsOptions.newBuilder().setTarget(serviceAddress).build());
    RegisterNamespaceRequest request =
        RegisterNamespaceRequest.newBuilder()
            .setName(NAMESPACE)
            .setWorkflowExecutionRetentionPeriod(Durations.fromDays(7))
            .build();
    service.blockingStub().registerNamespace(request);

```

In Go SDK you can use higher-level [NamespaceClient](https://github.com/temporalio/go-sdk/blob/00fb03096c85ee092304125c0054f2d78de377a8/client/client.go#L350):

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

```

---

_[View the full topic](https://community.temporal.io/t/creating-a-new-namespace-in-temporal/478)._
