{
  "openapi": "3.0.1",
  "info": {
    "title": "Users",
    "version": "v1.1"
  },
  "tags": [
    {
      "name": "Users"
    }
  ],
  "paths": {
    "/users": {
      "get": {
        "summary": "List users",
        "tags": [
          "Users"
        ],
        "description": "Retrieves the users linked to the eVault as a paginated index. Users whose access to the eVault has\nbeen disabled are included; check `disabled_at`. Snapdocs system admins are not included.\nRequires the `admin:read` scope.\n",
        "operationId": "getUsers",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "description": "Number of users to retrieve per page; values outside 1–200 are clamped",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25,
              "example": 25
            },
            "required": false
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number to retrieve; values below 1 are treated as 1",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "required": false
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Comma-separated list of sort columns, each optionally prefixed with `-` (descending) or `+` (ascending, the default when there is no prefix). A literal `+` in a query string is read as a space, so URL-encode it as `%2B` or omit it. Accepted columns: `name` (expands to `first_name,last_name`), `first_name`, `last_name`, `email`, `internal_user_id`, `created_at`. Defaults to `-created_at`.",
            "schema": {
              "type": "string",
              "default": "-created_at",
              "example": "name"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Users retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/users"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: authentication is missing or invalid"
          },
          "403": {
            "description": "forbidden: the token does not carry the admin:read scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/forbidden_error"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://demo.snapdocsevault.com/api",
      "description": "Snapdocs Evault demo environment"
    },
    {
      "url": "https://www.snapdocsevault.com/api",
      "description": "Snapdocs Evault production environment"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "paginated_index_links": {
        "type": "object",
        "properties": {
          "self": {
            "type": "string",
            "example": "https://www.snapdocsevault.com/api/users?page%5Bnumber%5D=1&page%5Bsize%5D=25",
            "description": "the current page"
          },
          "first": {
            "type": "string",
            "example": "https://www.snapdocsevault.com/api/users?page%5Bnumber%5D=1&page%5Bsize%5D=25",
            "description": "the first page"
          },
          "prev": {
            "type": "string",
            "description": "the previous page",
            "nullable": true
          },
          "next": {
            "type": "string",
            "description": "the next page",
            "nullable": true
          },
          "last": {
            "type": "string",
            "description": "the last page"
          }
        },
        "description": "JSON:API pagination links. Do not follow them: they are built with `page[number]` and `page[size]`, which this endpoint does not read. Page with the `page` and `per_page` query parameters and the `meta` object instead.",
        "deprecated": true
      },
      "paginated_index_meta": {
        "type": "object",
        "description": "meta data for pagination",
        "properties": {
          "current_page": {
            "type": "integer",
            "example": 1,
            "description": "the current page"
          },
          "total_pages": {
            "type": "integer",
            "example": 2,
            "description": "the total number of pages"
          },
          "next_page": {
            "type": "integer",
            "example": 2,
            "description": "the next page"
          },
          "page_size": {
            "type": "integer",
            "example": 25,
            "description": "the number of items per page"
          },
          "total_count": {
            "type": "integer",
            "example": 35,
            "description": "the total number of items"
          }
        }
      },
      "forbidden_error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "Insufficient Scope, a scope of admin:read is required.",
            "description": "the scope the token is missing"
          }
        }
      },
      "user": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
            "description": "The user id"
          },
          "type": {
            "type": "string",
            "example": "users",
            "description": "The type of object"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email",
                "example": "user@example.com",
                "description": "User email address"
              },
              "first_name": {
                "type": "string",
                "example": "John",
                "description": "User first name"
              },
              "last_name": {
                "type": "string",
                "example": "Doe",
                "description": "User last name"
              },
              "name": {
                "type": "string",
                "example": "John Doe",
                "description": "User full name (computed from first and last name)"
              },
              "internal_user_id": {
                "type": "string",
                "nullable": true,
                "example": "internal_123",
                "description": "Internal identifier for the user"
              },
              "disabled_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the user's access to this eVault was disabled, null if active. Taken from the user's access link to this eVault, so a user can be active on one eVault and disabled on another"
              },
              "last_sign_in_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "example": "2023-07-25T20:06:17.903Z",
                "description": "Timestamp when the user last logged in, null if the user never logged in"
              },
              "customer_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "example": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                "description": "Associated customer ID"
              },
              "role_id": {
                "type": "string",
                "format": "uuid",
                "example": "46f97b7e-8a32-4ca0-849c-85db4f92e9c7",
                "description": "The id of the user's role on this eVault"
              },
              "role_name": {
                "type": "string",
                "example": "Admin",
                "description": "Name of the user's role on this eVault"
              }
            }
          }
        }
      },
      "users": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/user"
            }
          },
          "links": {
            "$ref": "#/components/schemas/paginated_index_links"
          },
          "meta": {
            "$ref": "#/components/schemas/paginated_index_meta"
          }
        }
      }
    }
  }
}