# Create issue state (https://docs.capy.ai/api-reference/issues/create-issue-state)

`POST https://api.capy.ai/api/v1/issue-states`

## Authorization

Send an API key as a bearer token: `Authorization: Bearer $CAPY_API_KEY`. See https://docs.capy.ai/api-reference/authentication.md.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `type` | `open` \| `closed` | yes |  |
| `icon` | `dashed` \| `empty` \| `half` \| `progress` \| `check` \| `x` \| `clock` \| `hourglass` \| `snooze` \| `calendar` \| `pause` \| `hand` \| `stop` \| `chat` \| `question` \| `external` \| `sleep` \| `eye` \| `testtube` \| `search` \| `shield` \| `approved` \| `pull` \| `clipboard` \| `code` \| `rocket` \| `box` \| `package` \| `flag` \| `upload` \| `shipping` \| `truck` \| `parachute` \| `bug` \| `inbox` \| `fire` \| `warning` \| `alert` \| `siren` \| `unknown` \| `idea` \| `circlecheck` \| `checkmark` \| `inboxdone` \| `trophy` \| `archive` \| `minus` \| `ban` \| `duplicate` | yes |  |
| `color` | `gray` \| `blue` \| `purple` \| `pink` \| `red` \| `orange` \| `yellow` \| `lime` \| `green` | yes |  |

## Responses

- `200` IssueStateList: `IssueStateListEncoded`
- `400` capy/InvalidRequest: `capy_InvalidRequestEncoded`
- `401` capy/Unauthorized: `capy_UnauthorizedEncoded`
- `403` capy/Forbidden: `capy_ForbiddenEncoded \| capy_ForbiddenEncoded`
- `404` capy/IssueNotFound: `capy_IssueNotFoundEncoded`
- `429` capy/RateLimited: `capy_RateLimitedEncoded`

## Example

```bash
curl -X POST "https://api.capy.ai/api/v1/issue-states" \
  -H "Authorization: Bearer $CAPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"<name>","type":"open","icon":"dashed","color":"gray"}'
```

## Referenced schemas

```json
{
  "IssueStateListEncoded": {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/IssueStateEncoded"
        }
      }
    },
    "required": [
      "items"
    ],
    "additionalProperties": false
  },
  "IssueStateEncoded": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "type": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ]
          },
          {
            "$ref": "#/components/schemas/UnsupportedMember_1"
          }
        ]
      },
      "icon": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "dashed",
              "empty",
              "half",
              "progress",
              "check",
              "x",
              "clock",
              "hourglass",
              "snooze",
              "calendar",
              "pause",
              "hand",
              "stop",
              "chat",
              "question",
              "external",
              "sleep",
              "eye",
              "testtube",
              "search",
              "shield",
              "approved",
              "pull",
              "clipboard",
              "code",
              "rocket",
              "box",
              "package",
              "flag",
              "upload",
              "shipping",
              "truck",
              "parachute",
              "bug",
              "inbox",
              "fire",
              "warning",
              "alert",
              "siren",
              "unknown",
              "idea",
              "circlecheck",
              "checkmark",
              "inboxdone",
              "trophy",
              "archive",
              "minus",
              "ban",
              "duplicate"
            ]
          },
          {
            "$ref": "#/components/schemas/UnsupportedMember_8"
          }
        ]
      },
      "color": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "gray",
              "blue",
              "purple",
              "pink",
              "red",
              "orange",
              "yellow",
              "lime",
              "green"
            ]
          },
          {
            "$ref": "#/components/schemas/UnsupportedMember_9"
          }
        ]
      },
      "isDefault": {
        "type": "boolean"
      }
    },
    "required": [
      "id",
      "name",
      "type",
      "icon",
      "color",
      "isDefault"
    ],
    "additionalProperties": false
  },
  "UnsupportedMember_1": {
    "type": "string"
  },
  "UnsupportedMember_8": {
    "type": "string"
  },
  "UnsupportedMember_9": {
    "type": "string"
  },
  "capy_InvalidRequestEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/InvalidRequest"
        ]
      },
      "message": {
        "type": "string"
      }
    },
    "required": [
      "_tag",
      "message"
    ],
    "additionalProperties": false
  },
  "capy_UnauthorizedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Unauthorized"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ForbiddenEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Forbidden"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_IssueNotFoundEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/IssueNotFound"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_RateLimitedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/RateLimited"
        ]
      },
      "retryAfterSeconds": {
        "type": "integer"
      }
    },
    "required": [
      "_tag",
      "retryAfterSeconds"
    ],
    "additionalProperties": false
  },
  "CreateIssueStateRequest": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "allOf": [
          {
            "minLength": 1
          },
          {
            "maxLength": 64
          }
        ]
      },
      "type": {
        "type": "string",
        "enum": [
          "open",
          "closed"
        ]
      },
      "icon": {
        "type": "string",
        "enum": [
          "dashed",
          "empty",
          "half",
          "progress",
          "check",
          "x",
          "clock",
          "hourglass",
          "snooze",
          "calendar",
          "pause",
          "hand",
          "stop",
          "chat",
          "question",
          "external",
          "sleep",
          "eye",
          "testtube",
          "search",
          "shield",
          "approved",
          "pull",
          "clipboard",
          "code",
          "rocket",
          "box",
          "package",
          "flag",
          "upload",
          "shipping",
          "truck",
          "parachute",
          "bug",
          "inbox",
          "fire",
          "warning",
          "alert",
          "siren",
          "unknown",
          "idea",
          "circlecheck",
          "checkmark",
          "inboxdone",
          "trophy",
          "archive",
          "minus",
          "ban",
          "duplicate"
        ]
      },
      "color": {
        "type": "string",
        "enum": [
          "gray",
          "blue",
          "purple",
          "pink",
          "red",
          "orange",
          "yellow",
          "lime",
          "green"
        ]
      }
    },
    "required": [
      "name",
      "type",
      "icon",
      "color"
    ],
    "additionalProperties": false
  }
}
```

Full document: https://docs.capy.ai/openapi.json