{
  "swagger": "2.0",
  "info": {
    "title": "Secrets service",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/secrets/v1/secrets": {
      "post": {
        "operationId": "SecretService_create",
        "summary": "Create",
        "tags": [
          "Secrets Service"
        ],
        "description": "Create a new secret.",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/CreateSecretRequest"
            },
            "required": true,
            "x-example": {
              "name": "<name>",
              "description": "<description>",
              "decryptedValue": "<decrypted value>"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Secret"
            },
            "x-example": {
              "rid": "<secret rid>",
              "name": "<name>",
              "description": "<description>",
              "createdBy": "<created by>",
              "properties": {
                "<key>": "<property value>"
              },
              "labels": [
                "<label>"
              ],
              "createdAt": "2026-01-01T00:00:00Z",
              "isArchived": true
            }
          }
        }
      }
    },
    "/secrets/v1/secrets/{rid}": {
      "get": {
        "operationId": "SecretService_get",
        "summary": "Get",
        "tags": [
          "Secrets Service"
        ],
        "description": "Get secret by rid.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Secret"
            },
            "x-example": {
              "rid": "<secret rid>",
              "name": "<name>",
              "description": "<description>",
              "createdBy": "<created by>",
              "properties": {
                "<key>": "<property value>"
              },
              "labels": [
                "<label>"
              ],
              "createdAt": "2026-01-01T00:00:00Z",
              "isArchived": true
            }
          }
        }
      },
      "put": {
        "operationId": "SecretService_update",
        "summary": "Update",
        "tags": [
          "Secrets Service"
        ],
        "description": "Update a secret by rid.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid",
            "required": true
          },
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UpdateSecretRequest"
            },
            "required": true,
            "x-example": {
              "name": "<name>",
              "description": "<description>",
              "properties": {
                "<key>": "<property value>"
              },
              "labels": [
                "<label>"
              ],
              "decryptedValue": "<decrypted value>"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Secret"
            },
            "x-example": {
              "rid": "<secret rid>",
              "name": "<name>",
              "description": "<description>",
              "createdBy": "<created by>",
              "properties": {
                "<key>": "<property value>"
              },
              "labels": [
                "<label>"
              ],
              "createdAt": "2026-01-01T00:00:00Z",
              "isArchived": true
            }
          }
        }
      },
      "delete": {
        "operationId": "SecretService_delete",
        "summary": "Delete",
        "tags": [
          "Secrets Service"
        ],
        "description": "Delete a secret by rid. This is a permanent deletion. To perform a soft delete, use the archive endpoint.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/secrets/v1/secrets/batch": {
      "post": {
        "operationId": "SecretService_getBatch",
        "summary": "Get batch",
        "tags": [
          "Secrets Service"
        ],
        "description": "Get secrets by a set of rids.",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/GetSecretsRequest"
            },
            "required": true,
            "x-example": {
              "secretRids": [
                "<secret rid>"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetSecretsResponse"
            },
            "x-example": {
              "response": [
                {
                  "rid": "<secret rid>",
                  "name": "<name>",
                  "description": "<description>",
                  "createdBy": "<created by>",
                  "properties": {
                    "<key>": "<property value>"
                  },
                  "labels": [
                    "<label>"
                  ],
                  "createdAt": "2026-01-01T00:00:00Z",
                  "isArchived": true
                }
              ]
            }
          }
        }
      }
    },
    "/secrets/v1/secrets/{rid}/archive": {
      "put": {
        "operationId": "SecretService_archive",
        "summary": "Archive",
        "tags": [
          "Secrets Service"
        ],
        "description": "Archive a secret by rid.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/secrets/v1/secrets/{rid}/unarchive": {
      "put": {
        "operationId": "SecretService_unarchive",
        "summary": "Unarchive",
        "tags": [
          "Secrets Service"
        ],
        "description": "Unarchive a secret by rid.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/secrets/v1/secrets/search": {
      "post": {
        "operationId": "SecretService_search",
        "summary": "Search",
        "tags": [
          "Secrets Service"
        ],
        "description": "Returns metadata about secrets that match a given query.",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/SearchSecretsRequest"
            },
            "required": true,
            "x-example": {
              "query": {
                "type": "searchText",
                "searchText": "<search text>"
              },
              "sort": {
                "isDescending": true,
                "field": "CREATED_AT"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/SearchSecretsResponse"
            },
            "x-example": {
              "results": [
                {
                  "rid": "<secret rid>",
                  "name": "<name>",
                  "description": "<description>",
                  "createdBy": "<created by>",
                  "properties": {
                    "<key>": "<property value>"
                  },
                  "labels": [
                    "<label>"
                  ],
                  "createdAt": "2026-01-01T00:00:00Z",
                  "isArchived": true
                }
              ],
              "nextPageToken": "<token>"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "ArchivedStatus": {
      "type": "string",
      "enum": [
        "NOT_ARCHIVED",
        "ARCHIVED"
      ]
    },
    "Property": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "x-alias": "PropertyName"
        },
        "value": {
          "type": "string",
          "x-alias": "PropertyValue"
        }
      },
      "required": [
        "name",
        "value"
      ]
    },
    "CreateSecretRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "decryptedValue": {
          "type": "string"
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "x-alias": "PropertyValue"
          },
          "x-map-key": "PropertyName"
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "Label"
          },
          "uniqueItems": true
        },
        "workspace": {
          "type": "string",
          "format": "rid",
          "x-alias": "WorkspaceRid",
          "description": "The workspace in which to create the secret. If not provided, the secret will be created in the default workspace for the user's organization, if the default workspace for the organization is configured."
        }
      },
      "required": [
        "name",
        "description",
        "decryptedValue"
      ],
      "example": {
        "name": "<name>",
        "description": "<description>",
        "decryptedValue": "<decrypted value>"
      }
    },
    "GetSecretsRequest": {
      "type": "object",
      "properties": {
        "secretRids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "rid",
            "x-alias": "SecretRid"
          },
          "uniqueItems": true
        }
      },
      "example": {
        "secretRids": [
          "<secret rid>"
        ]
      }
    },
    "GetSecretsResponse": {
      "type": "object",
      "properties": {
        "response": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Secret"
          },
          "uniqueItems": true
        }
      }
    },
    "SearchSecretsQuery": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "searchText",
            "label",
            "property",
            "and",
            "or",
            "workspace"
          ]
        },
        "searchText": {
          "type": "string"
        },
        "label": {
          "type": "string",
          "x-alias": "Label"
        },
        "property": {
          "$ref": "#/definitions/Property"
        },
        "and": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SearchSecretsQuery"
          },
          "uniqueItems": true
        },
        "or": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SearchSecretsQuery"
          },
          "uniqueItems": true
        },
        "workspace": {
          "type": "string",
          "format": "rid",
          "x-alias": "WorkspaceRid"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "searchText",
        "searchText": "string"
      }
    },
    "SearchSecretsRequest": {
      "type": "object",
      "properties": {
        "query": {
          "$ref": "#/definitions/SearchSecretsQuery"
        },
        "pageSize": {
          "type": "integer",
          "format": "int32",
          "description": "Defaults to 100. Will throw if larger than 1000."
        },
        "sort": {
          "$ref": "#/definitions/SortOptions"
        },
        "token": {
          "type": "string",
          "x-alias": "Token"
        },
        "archivedStatuses": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ArchivedStatus"
          },
          "uniqueItems": true,
          "description": "Default search status is NOT_ARCHIVED if none are provided. Allows for including archived secrets in search."
        }
      },
      "required": [
        "query",
        "sort"
      ],
      "example": {
        "query": {
          "type": "searchText",
          "searchText": "<search text>"
        },
        "sort": {
          "isDescending": true,
          "field": "CREATED_AT"
        }
      }
    },
    "SearchSecretsResponse": {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Secret"
          }
        },
        "nextPageToken": {
          "type": "string",
          "x-alias": "Token"
        }
      }
    },
    "Secret": {
      "type": "object",
      "properties": {
        "rid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "createdBy": {
          "type": "string",
          "format": "rid"
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "x-alias": "PropertyValue"
          },
          "x-map-key": "PropertyName"
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "Label"
          },
          "uniqueItems": true
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "isArchived": {
          "type": "boolean"
        }
      },
      "required": [
        "rid",
        "name",
        "description",
        "createdBy",
        "createdAt",
        "isArchived"
      ]
    },
    "SortField": {
      "type": "string",
      "enum": [
        "CREATED_AT"
      ]
    },
    "SortOptions": {
      "type": "object",
      "properties": {
        "isDescending": {
          "type": "boolean"
        },
        "field": {
          "$ref": "#/definitions/SortField"
        }
      },
      "required": [
        "isDescending",
        "field"
      ]
    },
    "UpdateSecretRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "x-alias": "PropertyValue"
          },
          "x-map-key": "PropertyName"
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "Label"
          },
          "uniqueItems": true
        },
        "decryptedValue": {
          "type": "string"
        }
      },
      "example": {
        "name": "<name>",
        "description": "<description>",
        "properties": {
          "<key>": "<property value>"
        },
        "labels": [
          "<label>"
        ],
        "decryptedValue": "<decrypted value>"
      }
    }
  },
  "tags": [
    {
      "name": "Secrets Service",
      "x-displayName": "Secrets service",
      "description": "The secrets service provides functionality for creating and retrieving customer secrets (e.g. influx passwords, API keys, etc)",
      "x-errors": [
        {
          "status": 500,
          "errorCode": "FAILED_PRECONDITION",
          "errorName": "Secrets:UnableToEncryptSecret"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Secrets:SecretNotFound"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Secrets:SecretsNotFound"
        }
      ]
    }
  ]
}
