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

# Create a label

# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "HTTPError": {
        "properties": {
          "detail": {
            "type": "object"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Label": {
        "properties": {
          "color": {
            "default": null,
            "nullable": true,
            "type": "string"
          },
          "system_defined": {
            "default": null,
            "nullable": true,
            "type": "boolean"
          },
          "value": {
            "default": null,
            "nullable": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "LabelDetailResponse": {
        "properties": {
          "label": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Label"
              }
            ],
            "default": null,
            "nullable": true
          },
          "status": {
            "default": 200,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "PublicApiAddLabelRequest": {
        "properties": {
          "background_color": {
            "default": null,
            "description": "Background color in HEX.",
            "nullable": true,
            "type": "string"
          },
          "color": {
            "default": null,
            "deprecated": true,
            "description": "Deprecated: Use 'background_color' and 'text_color' instead.",
            "nullable": true,
            "type": "string"
          },
          "text_color": {
            "default": null,
            "description": "Text color in HEX.",
            "nullable": true,
            "type": "string"
          },
          "value": {
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "detail": {
            "properties": {
              "<location>": {
                "properties": {
                  "<field_name>": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "description": "Authorization header containing the Nudge API Token",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "Nudge API",
    "version": "1.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/1.0/labels": {
      "post": {
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiAddLabelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelDetailResponse"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a label",
        "tags": [
          "Labels"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.nudgesecurity.io"
    }
  ],
  "tags": [
    {
      "name": "Labels"
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 101,
      "1": 130,
      "2": 205,
      "3": 225,
      "4": 131,
      "5": 178,
      "6": 81,
      "7": 0,
      "8": 15,
      "9": 104,
      "10": 80,
      "11": 14
    }
  }
}
```