> This page is for Schema Service, version v3 (latest) (default).
> 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 5 - Create and-fetch a Schema

# Task 5 - Create a Schema

This task explains how to create a schema for your application.

A schema is an object in the Forge Schema service that represents a schema specification. A schema specification is a blueprint that describes how information is organized and constrained within a block of data. It is essentially a JSON specification that defines the constituents of the data. It provides a structure and set of rules to keep everything consistent and interoperable in a system.

## Expected task outcome

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

* Create a draft schema.
* Fetch a draft schema.
* Publish schema.
* Fetch Published schema

## Endpoints used in this task

You will use the following API endpoints in this task:

.. list-table::
:widths: 10, 50, 40
:header-rows: 1

* * Method
  * Endpoint
  * Operation
* * POST
  * /groups/\{groupId}/libraries/\{libraryId}/schemas:draft-create
  * `Create a Draft Schema`\_
* * POST
  * /groups/\{groupId}/libraries/\{libraryId}/schemas
  * `Publish New Schema`\_
* * GET
  * /schemas/propertySets:\{groupId}.\{libraryId}:\{schemaId}-\{version}
  * `Fetch a Version of a Schema`\_

Step 1 - Create a Draft Schema

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

Note the `status` attribute is draft.

## Request

```ruby
 curl -X POST \
     'https://developer-stg.api.autodesk.com/schema/v3/groups/<GROUP_ID>/libraries/<LIBRARY_ID>/schemas:draft-create' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>' \
     -D {
         "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
         "name": "<SCHEMA_ID>",
         "semanticVersion": "<VERSION_OF_SCHEMA>",
         "schemaType": "propertySets",
         "releaseType": "major",
         "title": "<SCHEMA_TITLE>",
         "description": "<SCHEMA_DESCRIPTION>",
         "status": "draft",
         "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}"
        }
```

|

## Response

```json

{
 "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
 "name": "<SCHEMA_ID>",
 "semanticVersion": "<VERSION_OF_SCHEMA>",
 "schemaType": "propertySets",
 "title": "<SCHEMA_TITLE>",
 "description": "<SCHEMA_DESCRIPTION>",
 "status": "draft",
 "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}",
 "createdBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
 "createTime": "2022-08-19T03:15:25Z"
}
```

Step 2 - Fetch Draft Schema

In postman, Select **Task 5 > GET Fetch Draft Schema** request and click send. The equivalent cURL request is as follows.

## Request

```ruby
 curl -X GET \
     'https://developer-stg.api.autodesk.com/schema/v3/schemas/propertySets:<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>>-draft' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>' \
```

|

## Response

```json

{
 "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
 "name": "<SCHEMA_ID>",
 "semanticVersion": "<VERSION_OF_SCHEMA>",
 "schemaType": "propertySets",
 "title": "<SCHEMA_TITLE>",
 "description": "<SCHEMA_DESCRIPTION>",
 "status": "draft",
 "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}",
 "createdBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
 "createTime": "2022-09-14T10:26:40Z"
}
```

Note the `status` attribute is draft.

## Step 3 - Publish Schema

In postman, Select **Task 5 > POST Publish Schema** and click **Send**. The equivalent cURL request is as follows.

Note the `status` attribute is Published.

## Request

```ruby
 curl -X POST \
     'https://developer-stg.api.autodesk.com/schema/v3/groups/<GROUP_ID>/libraries/<LIBRARY_ID>/schemas' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>' \
     -D '{
     "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
     "name": "<SCHEMA_ID>",
     "semanticVersion": "<VERSION_OF_SCHEMA>",
     "schemaType": "propertySets",
     "releaseType": "major",
     "title": "<SCHEMA_TITLE>",
     "description": "<SCHEMA_DESCRIPTION>",
     "status": "published",
     "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}"
     }'
```

|

## Response

```json

{
 "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
 "name": "<SCHEMA_ID>",
 "semanticVersion": "<VERSION_OF_SCHEMA>",
 "schemaType": "propertySets",
 "title": "<SCHEMA_TITLE>",
 "description": "<SCHEMA_DESCRIPTION>",
 "status": "published",
 "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}",
 "createdBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
 "createTime": "2022-08-19T02:58:29Z"
}
```

Step 4 - Fetch Published Schema

In postman, Select **Task 5 > GET Fetch Published Schema** and click **Send**. The equivalent cURL request is as follows.

## Request

```ruby
 curl -X GET \
     'https://developer-stg.api.autodesk.com/schema/v3/schemas/propertySets:<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>' \
```

|

## Response

```json

 {
     "qualifier": "<GROUP_ID>.<LIBRARY_ID>",
     "name": "<SCHEMA_ID>",
     "semanticVersion": "<VERSION_OF_SCHEMA>",
     "schemaType": "propertySets",
     "title": "<SCHEMA_TITLE>",
     "description": "<SCHEMA_DESCRIPTION",
     "status": "published",
     "schema": "{\"typeid\":\"<GROUP_ID>.<LIBRARY_ID>:<SCHEMA_ID>-<VERSION_OF_SCHEMA>\",\"properties\":[{\"id\":\"height\",\"typeid\":\"Uint32\"}]}",
     "createdBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
     "createTime": "2022-08-16T06:52:00Z"
 }
```

Note the `status` attribute is published.