Getting started
Back to home
Getting started

Read selected environment secrets

Retrieve the values for the requested keys. This requires secrets:read; treat the response as sensitive data.

POST/api/customer/v1/projects/{projectId}/environment/secrets/read

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.

Request body

Send JSON with Content-Type: application/json. Nested fields and accepted values are listed in the schema.

FieldTypeRequired
keysstring[]Yes
Full request schema
{
  "type": "object",
  "properties": {
    "keys": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    }
  },
  "required": [
    "keys"
  ],
  "additionalProperties": false
}

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request POST "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/environment/secrets/read" \
  --header "Authorization: Bearer $HCODE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "keys": [
    "API_TOKEN"
  ]
}'

Response

The JSON shape is defined in the response schema.

Response schema
{
  "type": "object",
  "properties": {
    "variables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "isSecret": {
            "type": "boolean"
          }
        },
        "required": [
          "key",
          "value",
          "isSecret"
        ],
        "additionalProperties": true
      }
    },
    "operationId": {
      "type": "string"
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "href": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "href"
        ]
      }
    }
  },
  "required": [
    "variables"
  ],
  "additionalProperties": true
}

See errors and retries for failure responses.