async def METHOD_NAME(request: web.Request):
    await check_permission(request, "user.apikey.*")
    api_key = await parse_request_body_as(ApiKeyCreate, request)
    credentials = generate_api_credentials()
    try:
        repo = ApiKeyRepo(request)
        await repo.create(api_key, **credentials)
    except DatabaseError as err:
        raise web.HTTPBadRequest(
            reason="Invalid API key name: already exists",
            content_type=MIMETYPE_APPLICATION_JSON,
        ) from err
    return ApiKeyGet(
        display_name=api_key.display_name,
        api_key=credentials["api_key"],
        api_secret=credentials["api_secret"],
    ).dict(**RESPONSE_MODEL_POLICY)