# API keys

## List API keys

`GET https://app.italic.com/api/v2/api-keys`

Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Italic API",
    "version": "2.0.0",
    "description": "Recordings, devices, chat, tasks, workflows, connectors and notifications. Text syncs to Italic; audio stays on the client."
  },
  "servers": [
    {
      "url": "https://app.italic.com/api/v2"
    }
  ],
  "paths": {
    "/api-keys": {
      "get": {
        "operationId": "listKeys",
        "summary": "List API keys",
        "tags": [
          "API keys"
        ],
        "parameters": [],
        "description": "Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.",
        "security": [
          {
            "accountSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Writes without read permission return an ID and revision only.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for troubleshooting."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyList"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. Errors include a stable code and a readable message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from Settings → Developers → API keys."
      },
      "accountSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "A signed-in Italic account session. An API key cannot create or revoke keys."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 0,
                "maxLength": 100
              },
              "message": {
                "type": "string",
                "minLength": 0,
                "maxLength": 1000
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ]
      },
      "Key": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          },
          "name": {
            "type": "string",
            "minLength": 0,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "recordings:create",
                "recordings:read",
                "recordings:write",
                "recordings:delete",
                "events:read",
                "settings:read",
                "settings:write",
                "workflows:read",
                "workflows:write",
                "actions:review",
                "agent:chat",
                "workflows:manage",
                "connectors:manage",
                "webhooks:manage"
              ]
            }
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "expiresAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "KeyList": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Key"
            }
          }
        },
        "required": [
          "keys"
        ]
      }
    }
  }
}
```

## Create an API key

`POST https://app.italic.com/api/v2/api-keys`

Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Italic API",
    "version": "2.0.0",
    "description": "Recordings, devices, chat, tasks, workflows, connectors and notifications. Text syncs to Italic; audio stays on the client."
  },
  "servers": [
    {
      "url": "https://app.italic.com/api/v2"
    }
  ],
  "paths": {
    "/api-keys": {
      "post": {
        "operationId": "createKey",
        "summary": "Create an API key",
        "tags": [
          "API keys"
        ],
        "parameters": [],
        "description": "Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.",
        "security": [
          {
            "accountSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateKey"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Writes without read permission return an ID and revision only.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for troubleshooting."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyResult"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. Errors include a stable code and a readable message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from Settings → Developers → API keys."
      },
      "accountSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "A signed-in Italic account session. An API key cannot create or revoke keys."
      }
    },
    "schemas": {
      "CreateKey": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "recordings:create",
                "recordings:read",
                "recordings:write",
                "recordings:delete",
                "events:read",
                "settings:read",
                "settings:write",
                "workflows:read",
                "workflows:write",
                "actions:review",
                "agent:chat",
                "workflows:manage",
                "connectors:manage",
                "webhooks:manage"
              ]
            },
            "minItems": 1,
            "maxItems": 14
          },
          "expiresInDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "required": [
          "name",
          "scopes"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 0,
                "maxLength": 100
              },
              "message": {
                "type": "string",
                "minLength": 0,
                "maxLength": 1000
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ]
      },
      "Key": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          },
          "name": {
            "type": "string",
            "minLength": 0,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "recordings:create",
                "recordings:read",
                "recordings:write",
                "recordings:delete",
                "events:read",
                "settings:read",
                "settings:write",
                "workflows:read",
                "workflows:write",
                "actions:review",
                "agent:chat",
                "workflows:manage",
                "connectors:manage",
                "webhooks:manage"
              ]
            }
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "expiresAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "KeyResult": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/Key"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "key",
          "secret"
        ]
      }
    }
  }
}
```

## Revoke an API key

`DELETE https://app.italic.com/api/v2/api-keys/{id}`

Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Italic API",
    "version": "2.0.0",
    "description": "Recordings, devices, chat, tasks, workflows, connectors and notifications. Text syncs to Italic; audio stays on the client."
  },
  "servers": [
    {
      "url": "https://app.italic.com/api/v2"
    }
  ],
  "paths": {
    "/api-keys/{id}": {
      "delete": {
        "operationId": "deleteKey",
        "summary": "Revoke an API key",
        "tags": [
          "API keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          }
        ],
        "description": "Needs a signed-in Italic account session, such as the web app. API keys cannot create or revoke keys.",
        "security": [
          {
            "accountSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Writes without read permission return an ID and revision only.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for troubleshooting."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. Errors include a stable code and a readable message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from Settings → Developers → API keys."
      },
      "accountSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "A signed-in Italic account session. An API key cannot create or revoke keys."
      }
    },
    "schemas": {
      "Deleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "deleted"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 0,
                "maxLength": 100
              },
              "message": {
                "type": "string",
                "minLength": 0,
                "maxLength": 1000
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}
```
