# Sessions API

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

Use your own server and its scoped API keys.

## Delete all sessions

DELETE /api/sessions

Delete all sessions for the user. This will not delete the current session.

```json
{
  "description": "Delete all sessions for the user. This will not delete the current session.",
  "operationId": "deleteAllSessions",
  "parameters": [],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete all sessions",
  "tags": [
    "Sessions"
  ],
  "x-frameleaf-permission": "session.delete"
}
```

## Retrieve sessions

GET /api/sessions

Retrieve a list of sessions for the user.

```json
{
  "description": "Retrieve a list of sessions for the user.",
  "operationId": "getSessions",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/SessionResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve sessions",
  "tags": [
    "Sessions"
  ],
  "x-frameleaf-permission": "session.read"
}
```

## Create a session

POST /api/sessions

Create a session as a child to the current session. This endpoint is used for casting.

```json
{
  "description": "Create a session as a child to the current session. This endpoint is used for casting.",
  "operationId": "createSession",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SessionCreateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SessionCreateResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Create a session",
  "tags": [
    "Sessions"
  ],
  "x-frameleaf-permission": "session.create"
}
```

## Delete a session

DELETE /api/sessions/{id}

Delete a specific session by id.

```json
{
  "description": "Delete a specific session by id.",
  "operationId": "deleteSession",
  "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 session",
  "tags": [
    "Sessions"
  ],
  "x-frameleaf-permission": "session.delete"
}
```

## Update a session

PUT /api/sessions/{id}

Update a specific session identified by id.

```json
{
  "deprecated": true,
  "description": "Update a specific session identified by id.",
  "operationId": "updateSession",
  "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/SessionUpdateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SessionResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Update a session",
  "tags": [
    "Sessions",
    "Deprecated"
  ],
  "x-frameleaf-permission": "session.update"
}
```

## Lock a session

POST /api/sessions/{id}/lock

Lock a specific session by id.

```json
{
  "description": "Lock a specific session by id.",
  "operationId": "lockSession",
  "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": "Lock a session",
  "tags": [
    "Sessions"
  ],
  "x-frameleaf-permission": "session.lock"
}
```
