# Stacks API

Source: https://frameleaf.app/docs/api/reference/stacks/

Use your own server and its scoped API keys.

## Delete stacks

DELETE /api/stacks

Delete multiple stacks by providing a list of stack IDs.

```json
{
  "description": "Delete multiple stacks by providing a list of stack IDs.",
  "operationId": "deleteStacks",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/BulkIdsDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete stacks",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.delete"
}
```

## Retrieve stacks

GET /api/stacks

Retrieve a list of stacks.

```json
{
  "description": "Retrieve a list of stacks.",
  "operationId": "searchStacks",
  "parameters": [
    {
      "name": "primaryAssetId",
      "required": false,
      "in": "query",
      "description": "Filter by primary asset ID",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/StackResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve stacks",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.read"
}
```

## Create a stack

POST /api/stacks

Create a new stack by providing a name and a list of asset IDs to include in the stack. If any of the provided asset IDs are primary assets of an existing stack, the existing stack will be merged into the newly created stack.

```json
{
  "description": "Create a new stack by providing a name and a list of asset IDs to include in the stack. If any of the provided asset IDs are primary assets of an existing stack, the existing stack will be merged into the newly created stack.",
  "operationId": "createStack",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StackCreateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StackResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Create a stack",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.create"
}
```

## Delete a stack

DELETE /api/stacks/{id}

Delete a specific stack by its ID.

```json
{
  "description": "Delete a specific stack by its ID.",
  "operationId": "deleteStack",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete a stack",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.delete"
}
```

## Retrieve a stack

GET /api/stacks/{id}

Retrieve a specific stack by its ID.

```json
{
  "description": "Retrieve a specific stack by its ID.",
  "operationId": "getStack",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StackResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve a stack",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.read"
}
```

## Update a stack

PUT /api/stacks/{id}

Update an existing stack by its ID.

```json
{
  "deprecated": true,
  "description": "Update an existing stack by its ID.",
  "operationId": "updateStack",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StackUpdateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StackResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Update a stack",
  "tags": [
    "Stacks",
    "Deprecated"
  ],
  "x-frameleaf-permission": "stack.update"
}
```

## Remove an asset from a stack

DELETE /api/stacks/{id}/assets/{assetId}

Remove a specific asset from a stack by providing the stack ID and asset ID.

```json
{
  "description": "Remove a specific asset from a stack by providing the stack ID and asset ID.",
  "operationId": "removeAssetFromStack",
  "parameters": [
    {
      "name": "assetId",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    },
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Remove an asset from a stack",
  "tags": [
    "Stacks"
  ],
  "x-frameleaf-permission": "stack.update"
}
```
