# Reorder issue states (https://docs.capy.ai/api-reference/issues/reorder-issue-states)

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

## 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 |
| --- | --- | --- | --- |
| `stateIds` | string[] | yes | Every state of the organization, in the new order. |

## 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 PUT "https://api.capy.ai/api/v1/issue-states/order" \
  -H "Authorization: Bearer $CAPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stateIds":[]}'
```

## 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
  },
  "ReorderIssueStatesRequest": {
    "type": "object",
    "properties": {
      "stateIds": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "maxItems": 100,
        "description": "Every state of the organization, in the new order."
      }
    },
    "required": [
      "stateIds"
    ],
    "additionalProperties": false
  }
}
```

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