---
updatedAt: 2025-09-22T20:32:56.000Z
agentTools:
  projectIndex: https://docs.v7labs.com/llms.txt
---

# Create Annotation Class

Creates a new annotation class for the given team. Depending on provided parameters, the class can also immediately be associated with zero or more datasets within the team.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "darwin-api",
    "version": "2.0"
  },
  "servers": [
    {
      "url": "https://darwin.v7labs.com/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-default": "ApiKey {{key}}",
        "x-bearer-format": ""
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/teams/{slug_or_id}/annotation_classes": {
      "post": {
        "summary": "Create Annotation Class",
        "description": "Creates a new annotation class for the given team. Depending on provided parameters, the class can also immediately be associated with zero or more datasets within the team.",
        "operationId": "create-annotation-class",
        "parameters": [
          {
            "name": "slug_or_id",
            "in": "path",
            "description": "Id or slug of the team you're creating the annotation class in",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "metadata",
                  "annotation_types"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the new class"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the new class"
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Object containing class metadata",
                    "properties": {
                      "_color": {
                        "type": "string",
                        "description": "RGBA string representing the color used to render the class in various places.",
                        "default": "auto"
                      }
                    }
                  },
                  "annotation_types": {
                    "type": "array",
                    "description": "A list of annotation type to which the class will be associated. There should be exactly one main type and zero or more subtypes",
                    "default": [
                      "polygon"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "datasets": {
                    "type": "array",
                    "description": "A list of datasets the class will be added to upon creation",
                    "items": {
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "Id of the dataset the class is associated with (use either this or slug, but not both).",
                          "format": "int32"
                        },
                        "slug": {
                          "type": "string",
                          "description": "Slug of the dataset the class is associated with (use either this or slug, but not both)."
                        }
                      },
                      "type": "object"
                    }
                  },
                  "images": {
                    "type": "array",
                    "description": "An ordered list of images which will serve as thumbnails for the class.",
                    "items": {
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Valid UUID of the class image. Optional. Autogenerated if not provided."
                        },
                        "key": {
                          "type": "string",
                          "description": "Location on S3 the original image was uploaded to. Required, but needs to be generated using the upload info endpoint."
                        },
                        "crop_key": {
                          "type": "string",
                          "description": "Location on S3 the thumbnail was uploaded to. If not specified, a thumbnail will be generated automatically from the original image. Needs to be generated using the upload info endpoint."
                        },
                        "x": {
                          "type": "number",
                          "description": "X coordinate of the top left edge of the cropped area on the original image, which will be the thumbnail.",
                          "format": "float"
                        },
                        "y": {
                          "type": "number",
                          "description": "https://dash.readme.com/project/v7/v1.0/refs/create-annotation-classY coordinate of the top left edge of the cropped area on the original image, which will be the thumbnail.",
                          "format": "float"
                        },
                        "scale": {
                          "type": "number",
                          "description": "Zoom level of the original image when taking the crop. The crop is always 200 by 200 square.",
                          "format": "float"
                        },
                        "image_width": {
                          "type": "integer",
                          "description": "Actual width of the original image",
                          "format": "int32"
                        },
                        "image_height*": {
                          "type": "integer",
                          "description": "Actual height of the original image",
                          "format": "int32"
                        },
                        "index": {
                          "type": "integer",
                          "description": "Position of the image withing the list of class thumbnails",
                          "format": "int32"
                        }
                      },
                      "required": [
                        "key",
                        "x",
                        "y",
                        "scale",
                        "image_width",
                        "index"
                      ],
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"annotation_types\": [\n    {\n      \"description\": \"\",\n      \"granularity\": \"main\",\n      \"icon_url\": \"\",\n      \"id\": 614,\n      \"metadata_skeleton\": {\"_type\": \"map\"},\n      \"name\": \"polygon\",\n      \"subs\": [],\n      \"visible\": true\n    }\n  ],\n\n  \"dataset_id\": 5249,\n  \"description\": \"\",\n  \"id\": 1,\n  \"images\": [],\n  \"inserted_at\": \"2021-07-13T07:24:25\",\n  \"metadata\": {\n    \"_color\": \"rgba(122,122,122,1.0)\", \n  },\n  \"name\": \"Class-0\",\n  \"updated_at\": \"2021-07-13T07:24:25\"\n}"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```