> This page is for Schema Service, version v2.
> For other versions, use one of these documentation indexes:
> - v3 (latest) (default): https://autodesk.ferndocs.com/schema/schema-service/v3/llms.txt
> - v2: https://autodesk.ferndocs.com/schema/schema-service/v2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://autodesk.ferndocs.com/schema/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://autodesk.ferndocs.com/schema/_mcp/server.

# Task 3 - Create a Namespace

A namespace is a group of schemas. Namespaces insulate the schema in your namespace from the schema in other namespaces. Even if another namespace has a schema with the same name as your schema, it would not matter. This is because the Forge Schema service factors in the namespace in the unique ID it assigns to your schema.

Every namespace is private by default. The creator of the namespace has read, write, and delete access to the namespace.

## Expected task outcome

By the end of this task you will be able to:

* Create a new namespace.
* Fetch details of namespace.

## Endpoints used in this task

You will use the following API endpoints in this task:

| Method | Endpoint                                          | Operation          |
| ------ | ------------------------------------------------- | ------------------ |
| POST   | /companies/\{companyId}/namespaces                | Create a Namespace |
| GET    | /companies/\{companyId}/namespaces/\{namespaceId} | Fetch a Namespace  |

## Step 1 - Create a Namespace

In postman, Select **Task 2 > POST Create a Namespace**  and click **Send**. The equivalent cURL request is as follows.

### Request

```ruby
 curl -X POST \
     'https://developer-stg.api.autodesk.com/schema/v2/companies/<COMPNAY_ID>/namespaces' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer  <YOUR_ACCERSS_TOKEN>' \
     -d '{
             "type": "namespaces",
             "attributes": {,
                 "name": "<NAMESPACE_NAME>",
                 "title": "<NAMESPACE_TITLE>",
                 "description": "<NAMESPACE_DESCRIPTION>"
             }
         }'
```

In Postman, a script in the **Tests** tab saves the ID of the namespace to a variable named `NAMESPACE_ID`, so that it can be used in subsequent API calls.

|

### Response

```json

{
  "data": {
     "type": "namespaces",
     "id": "<NAMESPACE_ID",
     "attributes": {
         "name": "<NAMESPACE_NAME>",
         "title": "<NAMESPACE_TITLE>",
         "description": "<NAMESPACE_DESCRIPTION>",
         "createdBy": "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25",
         "createTime": "2022-06-20T03:36:28Z",
         "lastModifiedBy": "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25",
         "lastModifiedTime": "2022-06-20T03:36:28Z"
     }
 }
}
```

## Step 2 - Fetch Namespace

In Postman, Select **Task 2 > GET Fetch a Namespace** and click **Send**. The equivalent cURL request is as follows.

### Request

```ruby
 curl -X GET \
     'https://developer-stg.api.autodesk.com/schema/v2/companies/<COMPANY_ID/namespaces/<NAMESPACE_ID>' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>'
```

|

### Response

```json

{
  "data": {
     "type": "namespaces",
     "id": "NAMESPACE_ID",
     "attributes": {
         "name": "NAMESPACE_NAME",
         "title": "NAMESPACE_TITLE",
         "description": "NAMESPACE_DESCRIPTION",
         "permissions": [
             {
                 "Id": "read",
                 "Effect": "Allow",
                 "Subjects": {
                     "Service": [
                         "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25"
                     ]
                 },
                 "Action": "read"
             },
             {
                 "Id": "admin",
                 "Effect": "Allow",
                 "Subjects": {
                     "Service": [
                         "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25"
                     ]
                 },
                 "Action": "admin"
             },
             {
                 "Id": "delete",
                 "Effect": "Allow",
                 "Subjects": {
                     "Service": [
                         "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25"
                     ]
                 },
                 "Action": "delete"
             },
             {
                 "Id": "write",
                 "Effect": "Allow",
                 "Subjects": {
                     "Service": [
                         "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25"
                     ]
                 },
                 "Action": "write"
             }
         ],
         "createdBy": "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25",
         "createTime": "2022-06-20T03:36:28Z",
         "lastModifiedBy": "vRx4GPkPtgn6UwldLHddl1XoPxPNgm25",
         "lastModifiedTime": "2022-06-20T03:36:28Z"
     }
 }
}
```