Skip to main content
POST
/
v1
/
projects
/
secrets
Create a Secret
curl --request POST \
  --url https://api.tryhamsa.com/v1/projects/secrets \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "API_KEY",
  "value": "super-secret-value",
  "description": "Production API key",
  "tags": [
    "production",
    "api"
  ]
}
'
{
  "success": true,
  "message": "success",
  "data": {
    "id": "ed9b5601-f731-441a-8500-d9fc7610ef8f",
    "name": "API_KEY",
    "description": "Production API key",
    "tags": [
      "production",
      "api"
    ],
    "lastAccessedAt": null,
    "createdAt": "2024-12-15T00:00:00.000Z",
    "updatedAt": "2024-12-15T00:00:00.000Z"
  }
}

Authorizations

Authorization
string
header
required

Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '

Body

application/json

Request body containing the secret data

name
string
required

The name of the secret.

Example:

"API_KEY"

value
string
required

The secret value to store.

Example:

"super-secret-value"

description
string

An optional description of the secret.

Example:

"Production API key"

tags
string[]

Optional tags to categorize the secret.

Example:
["production", "api"]

Response

Secret created successfully

success
boolean
Example:

true

message
string
Example:

"success"

data
object