Manage Component Secrets

Manage Secrets via API

List Secrets

This endpoint returns a paginated list of secrets associated with a specific namespace.

export INSTILL_API_TOKEN=********

curl -X GET 'http://localhost:8080/v1beta/namespaces/NAMESPACE_ID/secrets' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $INSTILL_API_TOKEN"
from instill.clients import init_pipeline_client

pipeline = init_pipeline_client(api_token="INSTILL_API_TOKEN", url="http://localhost:8080")
pipeline.list_secrets(namespace_id="NAMESPACE_ID")
pipeline.close()

Get Secret

This endpoint allows for getting a secret.

 export INSTILL_API_TOKEN=********

curl -X GET 'http://localhost:8080/v1beta/namespaces/NAMESPACE_ID/secrets/SECRET_ID' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $INSTILL_API_TOKEN"
from instill.clients import init_pipeline_client

pipeline = init_pipeline_client(api_token="INSTILL_API_TOKEN", url="http://localhost:8080")
pipeline.get_secret(namespace_id="NAMESPACE_ID", secret_id="SECRET_ID")
pipeline.close()

Update Secret

This endpoint allows for updating a secret with a new value.

export INSTILL_API_TOKEN=********

curl -X PATCH 'http://localhost:8080/v1beta/namespaces/NAMESPACE_ID/secrets/SECRET_ID' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--data '{ "description": "A brief description of your secret", "value": "The
secret value" }'
from instill.clients import init_pipeline_client

pipeline = init_pipeline_client(api_token="INSTILL_API_TOKEN", url="http://localhost:8080")
pipeline.update_secret(
  namespace_id="NAMESPACE_ID",
  secret_id="SECRET_ID",
  description="A brief description of your secret",
  value="The secret value",
)
pipeline.close()

Delete Secret

This endpoint enables the deletion of a specified secret.

export INSTILL_API_TOKEN=********

curl -X DELETE 'http://localhost:8080/v1beta/namespaces/NAMESPACE_ID/secrets/SECRET_ID' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $INSTILL_API_TOKEN"
from instill.clients import init_pipeline_client

pipeline = init_pipeline_client(api_token="INSTILL_API_TOKEN", url="http://localhost:8080")
pipeline.delete_secret(namespace_id="NAMESPACE_ID", secret_id="SECRET_ID")
pipeline.close()

The NAMESPACE_ID and SECRET_ID path parameters must be replaced with the secret owner's ID (namespace) and the secret ID.

Secret Object

In the all APIs in Manage Secrets, all endpoints follow a consistent structure for request and response bodies. Below are the key fields:

  • id: The ID of the secret.
  • uid: The immutable UID of the secret.
  • name: The full resource name of the secret.
  • description: A brief description of the secret.
  • value: This is the secret value. Note that it is a request-only field and will not be included in the response.

For additional details, please refer to the API reference.

Example Secret Object:

{
  "name": "users/test/secrets/my-secret-1",
  "uid": "89fccd1b-eba6-4597-9462-ad0ddd18902b",
  "id": "my-secret-1",
  "value": "the-secret-value",
  "createTime": "2024-10-01T07:34:36.956689Z",
  "updateTime": "2024-10-01T07:34:36.956689Z",
  "description": "A secret"
}

Manage Secrets via Console

  1. Access the Secrets page:

    • Proceed to Console > Settings > Secrets.
    • This section provides a user-friendly interface for managing all your credential data.
  2. Create a new secret:

    • Press the Create Secret button.
    • Input a unique key and the corresponding credential data.
    • Press the Create Secret button to save the secret to make it available for pipeline configurations.
  3. Delete a secret:

    • Locate the secret you want to delete.
    • Press the Delete button to delete the secret.

By complying with these practices, Pipeline ensures that all credential data is managed securely, minimizing the risk of unauthorized access and potential breaches.