GoodMem
ReferenceClient SDKs.NET SDK

API Keys API

API Keys API documentation for .NET SDK

All URIs are relative to *http://localhost:8080*

MethodHTTP requestDescription
CreateApiKeyPOST /v1/apikeysCreate a new API key
DeleteApiKeyDELETE /v1/apikeys/{id}Delete an API key
ListApiKeysGET /v1/apikeysList API keys
UpdateApiKeyPUT /v1/apikeys/{id}Update an API key

CreateApiKey

CreateApiKeyResponse CreateApiKey (CreateApiKeyRequest createApiKeyRequest)

Create a new API key

Creates a new API key for authenticating with the API. New keys start in ACTIVE status and can be used immediately for authentication. The response includes the one-time raw API key value which will not be retrievable later - clients must save this value as it cannot be recovered. Requires CREATE_APIKEY_OWN permission (or CREATE_APIKEY_ANY for admin users). Side effects include generating cryptographically secure key material, recording creation timestamp, and tracking creator ID. Returns INVALID_ARGUMENT if expires_at is set to a time in the past.

Example

using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;

namespace Example
{
    public class CreateApiKeyExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "[http://localhost";](http://localhost";)
            // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
            HttpClient httpClient = new HttpClient();
            HttpClientHandler httpClientHandler = new HttpClientHandler();
            var apiInstance = new APIKeysApi(httpClient, config, httpClientHandler);
            var createApiKeyRequest = new CreateApiKeyRequest(); // CreateApiKeyRequest | API key configuration

            try
            {
                // Create a new API key
                CreateApiKeyResponse result = apiInstance.CreateApiKey(createApiKeyRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling APIKeysApi.CreateApiKey: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateApiKeyWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create a new API key
    `ApiResponse<CreateApiKeyResponse>` response = apiInstance.CreateApiKeyWithHttpInfo(createApiKeyRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling APIKeysApi.CreateApiKeyWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

NameTypeDescriptionNotes
createApiKeyRequestCreateApiKeyRequestAPI key configuration

Return type

CreateApiKeyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
201Successfully created API key with Location header* Location - URL of the created API key resource
400Invalid request - missing required fields or invalid format-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions to create API keys-

↑ Back to .NET SDK

DeleteApiKey

void DeleteApiKey (string id)

Delete an API key

Permanently deletes an API key. This operation cannot be undone and immediately invalidates the key for all future authentication attempts. TIP: For reversible deactivation, use PUT /v1/apikeys/{id} with status=INACTIVE instead. Requires DELETE_APIKEY_OWN permission for keys you own (or DELETE_APIKEY_ANY for admin users to delete any user's keys). Side effects include permanently removing the key record from the database and immediate authentication invalidation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;

namespace Example
{
    public class DeleteApiKeyExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "[http://localhost";](http://localhost";)
            // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
            HttpClient httpClient = new HttpClient();
            HttpClientHandler httpClientHandler = new HttpClientHandler();
            var apiInstance = new APIKeysApi(httpClient, config, httpClientHandler);
            var id = 550e8400-e29b-41d4-a716-446655440000;  // string | The unique identifier of the API key to delete

            try
            {
                // Delete an API key
                apiInstance.DeleteApiKey(id);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling APIKeysApi.DeleteApiKey: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteApiKeyWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete an API key
    apiInstance.DeleteApiKeyWithHttpInfo(id);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling APIKeysApi.DeleteApiKeyWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

NameTypeDescriptionNotes
idstringThe unique identifier of the API key to delete

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status codeDescriptionResponse headers
204API key successfully deleted-
400Invalid request - API key ID in invalid format-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions to delete this API key-
404Not found - API key with the specified ID does not exist-

↑ Back to .NET SDK

ListApiKeys

ListApiKeysResponse ListApiKeys ()

List API keys

Retrieves a list of API keys belonging to the authenticated user. The list includes metadata about each key but not the actual key values or key hashes for security reasons. Requires LIST_APIKEY_OWN permission (or LIST_APIKEY_ANY for admin users to view keys from any user). This is a read-only operation with no side effects.

Example

using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;

namespace Example
{
    public class ListApiKeysExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "[http://localhost";](http://localhost";)
            // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
            HttpClient httpClient = new HttpClient();
            HttpClientHandler httpClientHandler = new HttpClientHandler();
            var apiInstance = new APIKeysApi(httpClient, config, httpClientHandler);

            try
            {
                // List API keys
                ListApiKeysResponse result = apiInstance.ListApiKeys();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling APIKeysApi.ListApiKeys: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ListApiKeysWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // List API keys
    `ApiResponse<ListApiKeysResponse>` response = apiInstance.ListApiKeysWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling APIKeysApi.ListApiKeysWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

ListApiKeysResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved API keys-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions to list API keys-

↑ Back to .NET SDK

UpdateApiKey

ApiKeyResponse UpdateApiKey (string id, UpdateApiKeyRequest updateApiKeyRequest)

Update an API key

Updates an existing API key with new values for status or labels. IMPORTANT: Key ID, user ownership, key material, and audit fields cannot be modified - only status (ACTIVE/INACTIVE) and labels are mutable. Requires UPDATE_APIKEY_OWN permission for keys you own (or UPDATE_APIKEY_ANY for admin users to modify any user's keys). Side effects include updating the updated_at timestamp and recording the updater's user ID. This operation is idempotent - repeated identical requests have no additional effect.

Example

using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;

namespace Example
{
    public class UpdateApiKeyExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "[http://localhost";](http://localhost";)
            // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
            HttpClient httpClient = new HttpClient();
            HttpClientHandler httpClientHandler = new HttpClientHandler();
            var apiInstance = new APIKeysApi(httpClient, config, httpClientHandler);
            var id = 550e8400-e29b-41d4-a716-446655440000;  // string | The unique identifier of the API key to update
            var updateApiKeyRequest = new UpdateApiKeyRequest(); // UpdateApiKeyRequest | API key update details

            try
            {
                // Update an API key
                ApiKeyResponse result = apiInstance.UpdateApiKey(id, updateApiKeyRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling APIKeysApi.UpdateApiKey: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateApiKeyWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update an API key
    `ApiResponse<ApiKeyResponse>` response = apiInstance.UpdateApiKeyWithHttpInfo(id, updateApiKeyRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling APIKeysApi.UpdateApiKeyWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

NameTypeDescriptionNotes
idstringThe unique identifier of the API key to update
updateApiKeyRequestUpdateApiKeyRequestAPI key update details

Return type

ApiKeyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successfully updated API key-
400Invalid request - ID format or update parameters invalid-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions to update this API key-
404Not found - API key with the specified ID does not exist-

↑ Back to .NET SDK