Skip to main content

Hanko Admin API (0.3.0)

Introduction

This is the OpenAPI specification for the Hanko Admin API.

Authentication

The Admin API must be protected by an access management system.


User Management

Get a list of users

query Parameters
page
integer
Default: 1

The page which should be returned

per_page
integer
Default: 20

The number of returned items

user_id
string <uuid4>
Example: user_id=c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c

Only users with the specified user_id are included

email
string <email>
Example: email=example@example.com

Only users with the specified email are included

sort_direction
string
Enum: "asc" "desc"

The sort direction of the returned list (always sorted by created_at)

Responses

Response Headers
X-Total-Count
any
Example: 1234

The total count of the requested resource considering query parameter

Link
any
Example: "<http://localhost:8001/resource?page=1&per_page=10>; rel=\"first\",<http://localhost:8001/resource?page=16&per_page=10>; rel=\"last\",<http://localhost:8001/resource?page=6&per_page=10>; rel=\"next\",<http://localhost:8001/resource?page=4&per_page=10>; rel=\"prev\""

Web Linking as described in RFC5988

Response Schema: application/json
Array
id
required
string <uuid4>

The ID of the user

created_at
required
string <date-time>

Time of creation of the the user

updated_at
required
string <date-time>

Time of last update of the user

Array of objects (WebAuthnCredential)

List of registered Webauthn credentials

Array of objects (Email)

List of emails associated to the user

Response samples

Content type
application/json
[
  • {
    • "id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
    • "created_at": "2019-08-24T14:15:22Z",
    • "updated_at": "2019-08-24T14:15:22Z",
    • "webauthn_credentials": [
      ],
    • "emails": [
      ]
    }
]

Delete a user by ID

path Parameters
id
required
string <uuid4> (UUID4)
Example: c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c

ID of the user

Responses

Response samples

Content type
application/json
{
  • "code": 404,
  • "message": "Not found"
}

Get a user by ID

path Parameters
id
required
string <uuid4> (UUID4)
Example: c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c

ID of the user

Responses

Response Schema: application/json
id
required
string <uuid4>

The ID of the user

created_at
required
string <date-time>

Time of creation of the the user

updated_at
required
string <date-time>

Time of last update of the user

Array of objects (WebAuthnCredential)

List of registered Webauthn credentials

Array of objects (Email)

List of emails associated to the user

Response samples

Content type
application/json
{
  • "id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "webauthn_credentials": [
    • {
      }
    ],
  • "emails": [
    • {
      }
    ]
}

Audit Logs

Get a list of audit logs

query Parameters
page
integer
Default: 1

The page which should be returned

per_page
integer
Default: 20

The number of returned items

start_time
string
Example: start_time=2022-09-12T12:48:48Z

Date and time from which the logs are included

end_time
string
Example: end_time=2022-09-15T12:48:48Z

Date and time to which the logs are included

actor_user_id
string <uuid4>
Example: actor_user_id=c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c

Only audit logs with the specified user_id are included

actor_email
string <email>
Example: actor_email=example@example.com

Only audit logs with the specified email are included

meta_source_ip
string <ipv6>
Example: meta_source_ip=127.0.0.1

Only audit logs with the specified ip address are included

q
string
Example: q=example.com

Only audit logs are included when the search string matches values in meta_source_ip or actor_user_id or actor_email

type
Array of strings
Items Enum: "user_created" "password_set_succeeded" "password_set_failed" "password_login_succeeded" "password_login_failed" "passcode_login_init_succeeded" "passcode_login_init_failed" "passcode_login_final_succeeded" "passcode_login_final_failed" "webauthn_registration_init_succeeded" "webauthn_registration_init_failed" "webauthn_registration_final_succeeded" "webauthn_registration_final_failed" "webauthn_authentication_init_succeeded" "webauthn_authentication_init_failed" "webauthn_authentication_final_succeeded" "webauthn_authentication_final_failed" "thirdparty_signup_succeeded" "thirdparty_signin_succeeded"
Example: type=user_created

Only audit logs with the specified type are included

Responses

Response Headers
X-Total-Count
any
Example: 1234

The total count of the requested resource considering query parameter

Link
any
Example: "<http://localhost:8001/resource?page=1&per_page=10>; rel=\"first\",<http://localhost:8001/resource?page=16&per_page=10>; rel=\"last\",<http://localhost:8001/resource?page=6&per_page=10>; rel=\"next\",<http://localhost:8001/resource?page=4&per_page=10>; rel=\"prev\""

Web Linking as described in RFC5988

Response Schema: application/json
Array
id
required
string <uuid4>

The ID of the audit log

type
required
string
Enum: "user_created" "password_set_succeeded" "password_set_failed" "password_login_succeeded" "password_login_failed" "passcode_login_init_succeeded" "passcode_login_init_failed" "passcode_login_final_succeeded" "passcode_login_final_failed" "webauthn_registration_init_succeeded" "webauthn_registration_init_failed" "webauthn_registration_final_succeeded" "webauthn_registration_final_failed" "webauthn_authentication_init_succeeded" "webauthn_authentication_init_failed" "webauthn_authentication_final_succeeded" "webauthn_authentication_final_failed" "thirdparty_signup_succeeded" "thirdparty_signin_succeeded"

The type of the audit log

meta_http_request_id
required
string

The ID of the corresponding http request

meta_source_ip
required
string <ip-address>

The IP from where the http request came from

meta_user_agent
required
string

The user agent from where the http request came from

created_at
required
string <date-time>

Time of creation of the the audit log

updated_at
required
string <date-time>

Time of last update of the audit log

error
string

A more detailed message why something failed

actor_user_id
string <uuid4>

The userID from the actor

actor_email
string <email>

The email from the actor

Response samples

Content type
application/json
[
  • {
    • "id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
    • "type": "user_created",
    • "error": "string",
    • "meta_http_request_id": "0a2xsrhlhiQv49FIpq8KV8uQVq6ky9Bw",
    • "meta_source_ip": "172.27.0.1",
    • "meta_user_agent": "string",
    • "actor_user_id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
    • "actor_email": "user@example.com",
    • "created_at": "2022-09-14T12:15:09.788784Z",
    • "updated_at": "2022-09-14T12:15:09.788784Z"
    }
]

Metrics

Get Prometheus metrics.

Responses

Response Schema: text/plain
string