GoodMemGoodMem

User Enrollments

One-time human-user enrollment completion.

Methods on this page are called through client.user_enrollments.

client.user_enrollments.complete

client.user_enrollments.complete(request: CompleteUserEnrollmentRequest, requestOptions?: RequestOptions): Promise<CompleteUserEnrollmentResponseShape>

Exchanges a one-time enrollment credential for the human's initial self-owned API key. This endpoint does not use ordinary API-key authentication. Omit both optional key fields for server generation; a fresh response discloses the raw key exactly once and cannot be safely retried after an ambiguous outcome. Supply and retain both fields for client mode, where only an exact tuple retry is safe and raw material is never echoed. Status precedence is request-shape errors (400), then the same generic authentication failure for every nonblank unusable enrollment (401); key conflicts or concurrent lifecycle winners return 409, rate limits return 429, and unexpected failures return 500.

HTTP: POST /v1/user-enrollments:complete

Parameters

ParameterTypeDescription
requestCompleteUserEnrollmentRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;CompleteUserEnrollmentResponseShape&gt;

Example

const completedEnrollment = await client.userEnrollments.complete({
  enrollmentToken: "gme_...",
});
// Server-generated raw API keys are disclosed only on fresh completion.
console.log(completedEnrollment.rawApiKey);

Data Models

Interfaces

CompleteUserEnrollmentRequest

Exchanges one enrollment credential for the target human's initial API key. Omit both apiKeyId and rawApiKey for server-generated key material, or supply both for exact-retry-safe client-generated completion; supplying only one is invalid.

FieldTypeRequiredDescription
enrollmentTokenstringyesRequired one-time enrollment credential. Never log or persist it.
apiKeyIdstring | nullnoOptional client-generated API-key UUID retained for exact retries. Must be supplied together with rawApiKey, or both fields must be omitted.
rawApiKeystring | nullnoOptional canonical client-generated API key. Must be supplied together with apiKeyId, never logged, and retained for exact retries; omit both fields for server generation.

CompleteUserEnrollmentResponse

Initial API-key metadata, exact-retry classification, and one-time raw key material only for a fresh server-generated completion. Client-supplied keys are never echoed.

FieldTypeRequiredDescription
apiKeyApiKeyResponseyesOUTPUT_ONLY; metadata for the newly published initial API key.
alreadyCompletedbooleanyesOUTPUT_ONLY; true when the exact completion tuple already committed.
rawApiKeystring | nullnoOUTPUT_ONLY; one-time raw API key returned only by a fresh server-generated completion. Omitted for client-supplied completion and every replay.

Response Shapes

Response shape types model values returned by the SDK after forward-compatible unknown enum strings are coerced to null.

CompleteUserEnrollmentResponseShape

FieldTypeRequiredDescription
apiKeyApiKeyResponseShapeyesOUTPUT_ONLY; metadata for the newly published initial API key.
alreadyCompletedbooleanyesOUTPUT_ONLY; true when the exact completion tuple already committed.
rawApiKeystring | nullnoOUTPUT_ONLY; one-time raw API key returned only by a fresh server-generated completion. Omitted for client-supplied completion and every replay.