export interface CreateApiKeyResponseDto { apiKey: ApiKey; /** * Credential returned only once, immediately after creation. * It cannot be retrieved again later. */ credential: string; } export interface ApiKey { id: string; spaceId: string; name: string; status: ApiKeyStatus; privileges: ApiPrivilege; security?: ApiKeySecurityPolicy; /** * Prefix used to identify the API key without exposing the secret. */ keyPrefix: string; createdBy: string; createdAt: Date; updatedBy?: string; updatedAt?: Date; lastUsedAt?: Date; lastUsedIp?: string; } export type ApiKeyStatus = "active" | "disabled" | "revoked"; export interface ApiPrivilege { /** @deprecated Replaced by scopes. */ Messages?: boolean; /** @deprecated Replaced by scopes. */ Contacts?: boolean; /** * Permissions granted to the API key. * * Examples: * - contacts.read * - contacts.write * - messages.read * - messages.send */ scopes: ApiScope[]; /** * Optional restrictions applied to this API key. * * Restrictions limit which resources can be accessed, * independently of the granted scopes. */ restrictions?: ApiResourceRestrictions; } export interface ApiKeySecurityPolicy { /** * Allowed IPv4/IPv6 addresses or CIDR ranges. */ allowedIpAddresses?: string[]; /** * Optional expiration date. */ expiresAt?: Date; } export type ApiScope = (typeof API_SCOPES)[keyof typeof API_SCOPES]; export declare const API_SCOPES: { readonly CONTACTS_READ: "contacts.read"; readonly CONTACTS_WRITE: "contacts.write"; readonly COMPANIES_READ: "companies.read"; readonly COMPANIES_WRITE: "companies.write"; readonly CONVERSATIONS_READ: "conversations.read"; readonly CONVERSATIONS_WRITE: "conversations.write"; readonly MESSAGES_READ: "messages.read"; readonly MESSAGES_SEND: "messages.send"; readonly TICKETS_READ: "tickets.read"; readonly TICKETS_WRITE: "tickets.write"; readonly TASKS_READ: "tasks.read"; readonly TASKS_WRITE: "tasks.write"; readonly CALENDAR_READ: "calendar.read"; readonly CALENDAR_WRITE: "calendar.write"; readonly FILES_READ: "files.read"; readonly FILES_WRITE: "files.write"; readonly CALLS_READ: "calls.read"; readonly CALLS_MAKE: "calls.make"; readonly WEBHOOKS_READ: "webhooks.read"; readonly WEBHOOKS_WRITE: "webhooks.write"; readonly USERS_READ: "users.read"; readonly FLOWS_READ: "flows.read"; readonly FLOWS_EXECUTE: "flows.execute"; readonly REPORTS_READ: "reports.read"; }; export interface ApiResourceRestrictions { /** * Restrict access to specific communication channels. */ channelIds?: string[]; /** * Restrict access to specific teams/groups. */ teamIds?: string[]; /** * Restrict access to specific users/agents. */ userIds?: string[]; }