@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
35 lines • 2.15 kB
TypeScript
import { UnkeyCore } from "../core.js";
import { RequestOptions } from "../lib/sdks.js";
import * as components from "../models/components/index.js";
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
import * as errors from "../models/errors/index.js";
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
import { UnkeyError } from "../models/errors/unkeyerror.js";
import { APIPromise } from "../types/async.js";
import { Result } from "../types/fp.js";
/**
* Create API key
*
* @remarks
* Create a new API key for user authentication and authorization.
*
* Use this endpoint when users sign up, upgrade subscription tiers, or need additional keys. Keys are cryptographically secure and unique to the specified API namespace.
*
* **Important**: The key is returned only once. Store it immediately and provide it to your user, as it cannot be retrieved later.
*
* **Common use cases:**
* - Generate keys for new user registrations
* - Create additional keys for different applications
* - Issue keys with specific permissions or limits
*
* **Required Permissions**
*
* Your root key needs one of:
* - `api.*.create_key` (create keys in any API)
* - `api.<api_id>.create_key` (create keys in specific API)
*
* If set, this operation will use {@link Security.rootKey} from the global security.
*/
export declare function keysCreateKey(client: UnkeyCore, request: components.V2KeysCreateKeyRequestBody, options?: RequestOptions): APIPromise<Result<components.V2KeysCreateKeyResponseBody, errors.BadRequestErrorResponse | errors.UnauthorizedErrorResponse | errors.ForbiddenErrorResponse | errors.NotFoundErrorResponse | errors.TooManyRequestsErrorResponse | errors.InternalServerErrorResponse | UnkeyError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
//# sourceMappingURL=keysCreateKey.d.ts.map