---
agentTools:
  projectIndex: https://somnio.readme.io/llms.txt
---

# Create a Layer

The `POST` method on the `/v1/layer` route is designed for creating a new layer within a Metafuse project. This operation requires a JSON payload in the request body, adhering to the defined schema (`MetafuApiDeSuTmK7LBO81n`) to ensure accurate layer creation. Here's a breakdown of the parameters encapsulated in the request schema:

- `traitName` (required): A distinctive name assigned to the trait within a trait category, aiding in identification and organization.
- `image` (required): A base64 encoded string representing the layer's image, utilized for visualization and display purposes.
- `traitRarity` (optional): A numeric value indicating the rarity of the trait, representing the likelihood of its appearance during collection generation (e.g., 10 for 10%).
- `projectId` (required): A unique identifier linking the layer to its respective project.
- `traitCategory` (required): A categorization for the trait, facilitating grouping and sorting of similar traits.
- `generationOrder` (required): A numeric value depicting the generation sequence of the layer among others.

Upon successful creation, the route responds with a `200` status code, signifying a successful operation. Conversely, a `400` status code is returned in cases where the request body does not comply with the required schema or other client-side errors occur.

This route empowers developers to seamlessly initialize new layers, supplying essential information like the trait details, image, project linkage, and generation order to ensure a well-documented and organized layer creation within the Metafuse platform.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Metafuse Gateway",
    "description": "This API is a comprehensive service designed to enable smooth interaction with our asset management system. This includes operations at the project, item, and layer levels, catering to a wide array of functionalities ranging from image uploading to specific attribute modifications. It's particularly crafted for handling digital assets, especially images, providing users with the flexibility to manage their resources efficiently.",
    "version": "2023-06-20T18:00:42Z"
  },
  "servers": [
    {
      "url": "https://gateway.metafuse.me"
    }
  ],
  "paths": {
    "/v1/layer": {
      "summary": "Create a New Layer",
      "description": "The `POST` method on the `/v1/layer` route is designed for creating a new layer within a Metafuse project. This operation requires a JSON payload in the request body, adhering to the defined schema (`MetafuApiDeSuTmK7LBO81n`) to ensure accurate layer creation. Here's a breakdown of the parameters encapsulated in the request schema:\n\n- `traitName` (required): A distinctive name assigned to the trait within a trait category, aiding in identification and organization.\n- `image` (required): A base64 encoded string representing the layer's image, utilized for visualization and display purposes.\n- `traitRarity` (optional): A numeric value indicating the rarity of the trait, representing the likelihood of its appearance during collection generation (e.g., 10 for 10%).\n- `projectId` (required): A unique identifier linking the layer to its respective project.\n- `traitCategory` (required): A categorization for the trait, facilitating grouping and sorting of similar traits.\n- `generationOrder` (required): A numeric value depicting the generation sequence of the layer among others.\n\nUpon successful creation, the route responds with a `200` status code, signifying a successful operation. Conversely, a `400` status code is returned in cases where the request body does not comply with the required schema or other client-side errors occur.\n\nThis route empowers developers to seamlessly initialize new layers, supplying essential information like the trait details, image, project linkage, and generation order to ensure a well-documented and organized layer creation within the Metafuse platform.\n",
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetafuApiDeSuTmK7LBO81n"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "200 response",
            "content": {}
          },
          "400": {
            "description": "400 response",
            "content": {}
          }
        },
        "security": [
          {
            "MetafuseDeveloperApiStackRequestAuthorizer1C886840": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "MetafuApiDeSuTmK7LBO81n": {
        "required": [
          "generationOrder",
          "image",
          "projectId",
          "traitCategory",
          "traitName"
        ],
        "type": "object",
        "properties": {
          "traitName": {
            "type": "string",
            "description": "The unique name assigned to the trait. This should be distinctive within a trait category."
          },
          "image": {
            "type": "string",
            "description": "A base64 encoded string representing the image of the layer. This is used for visualization and display purposes.",
            "format": "base64"
          },
          "traitRarity": {
            "minimum": 0,
            "type": "number",
            "description": "The rarity score of the trait, indicative of how common or rare a trait is during collection generation. eg 10 for 10%"
          },
          "projectId": {
            "type": "string",
            "description": "The unique id assigned to the project."
          },
          "traitCategory": {
            "type": "string",
            "description": "The category of the trait. This aids in grouping and sorting traits that are similar."
          },
          "generationOrder": {
            "minimum": 0,
            "type": "number",
            "description": "The order in which the layer was generated. This illustrates the generation sequence amongst other layers."
          }
        },
        "description": "This model defines the schema for creating a new layer. It includes details about the trait, its associated image, project linkage, and the generation order."
      }
    },
    "securitySchemes": {
      "MetafuseDeveloperApiStackRequestAuthorizer1C886840": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-amazon-apigateway-authtype": "custom"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 144,
      "2": 178,
      "3": 32,
      "4": 71,
      "5": 34,
      "6": 16,
      "7": 7,
      "8": 88,
      "9": 94,
      "10": 157,
      "11": 150
    }
  }
}
```