Skip to main content

anthropic_api_keys

Creates, updates, deletes, gets or lists an anthropic_api_keys resource.

Overview

Nameanthropic_api_keys
TypeResource
Iddigitalocean.genai.anthropic_api_keys

Fields

The following fields are returned by SELECT queries:

A successful response.

NameDatatypeDescription
namestringName (example: example name)
created_atstring (date-time)Key creation date (example: 2023-01-01T00:00:00Z)
created_bystring (uint64)Created by user id from DO (example: 12345)
deleted_atstring (date-time)Key deleted date (example: 2023-01-01T00:00:00Z)
updated_atstring (date-time)Key last updated date (example: 2023-01-01T00:00:00Z)
uuidstringUuid (example: 123e4567-e89b-12d3-a456-426614174000)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
genai_get_anthropic_api_keyselectapi_key_uuidTo retrieve details of an Anthropic API key, send a GET request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.
genai_list_anthropic_api_keysselectpage, per_pageTo list all Anthropic API keys, send a GET request to /v2/gen-ai/anthropic/keys.
genai_create_anthropic_api_keyinsertTo create an Anthropic API key, send a POST request to /v2/gen-ai/anthropic/keys.
genai_update_anthropic_api_keyreplaceapi_key_uuidTo update an Anthropic API key, send a PUT request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.
genai_delete_anthropic_api_keydeleteapi_key_uuidTo delete an Anthropic API key, send a DELETE request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_key_uuidstringAPI key ID (example: "123e4567-e89b-12d3-a456-426614174000")
pageintegerPage number. (example: 1)
per_pageintegerItems per page. (example: 1)

SELECT examples

To retrieve details of an Anthropic API key, send a GET request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.

SELECT
name,
created_at,
created_by,
deleted_at,
updated_at,
uuid
FROM digitalocean.genai.anthropic_api_keys
WHERE api_key_uuid = '{{ api_key_uuid }}' -- required;

INSERT examples

To create an Anthropic API key, send a POST request to /v2/gen-ai/anthropic/keys.

INSERT INTO digitalocean.genai.anthropic_api_keys (
data__api_key,
data__name
)
SELECT
'{{ api_key }}',
'{{ name }}'
RETURNING
api_key_info
;

REPLACE examples

To update an Anthropic API key, send a PUT request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.

REPLACE digitalocean.genai.anthropic_api_keys
SET
data__api_key = '{{ api_key }}',
data__api_key_uuid = '{{ api_key_uuid }}',
data__name = '{{ name }}'
WHERE
api_key_uuid = '{{ api_key_uuid }}' --required
RETURNING
api_key_info;

DELETE examples

To delete an Anthropic API key, send a DELETE request to /v2/gen-ai/anthropic/keys/{api_key_uuid}.

DELETE FROM digitalocean.genai.anthropic_api_keys
WHERE api_key_uuid = '{{ api_key_uuid }}' --required;