# SecretMetadata

> Everything about a secret except its value, which can never be read back.

Everything about a secret except its value, which can never be read back.

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `id` * | string |  |
| `name` * | string |  |
| `environment_id` * | string |  |
| `service_id` | string or null | Null for secrets shared by every service in the environment. |
| `version` * | integer |  |
| `injected_as` | string or null | Environment variable name the value is injected as automatically (when the name is UPPER_SNAKE_CASE); otherwise reference it as `secret://name`. |
| `build` | boolean |  |
| `description` | string or null |  |
| `display` | string | Read-only. |
| `set_by` | [Actor](/docs/api/objects/actor/) |  |
| `referenced_by` | array of object |  |
| `last_used_at` | string (date-time) or null |  |
| `last_used_by_deployment_id` | string or null |  |
| `decrypts_last_7_days` | integer | How many times the value was decrypted (all by deploys, normally). |
| `created_at` * | string (date-time) |  |
| `updated_at` * | string (date-time) |  |

\* always present

## Example

```json
{
  "id": "sec_01jbx2m9k7q4r8t5v6w3y0z1sc",
  "name": "stripe-secret-key",
  "environment_id": "env_01jbx2m9k7q4r8t5v6w3y0z1en",
  "service_id": null,
  "version": 3,
  "injected_as": null,
  "build": false,
  "description": "Stripe live secret key",
  "display": "••••••• (set 2 min ago by Stewart Webb)",
  "set_by": {
    "type": "user",
    "id": "usr_01jbx2m9k7q4r8t5v6w3y0z1us",
    "display": "Stewart Webb"
  },
  "referenced_by": [
    {
      "service": "web",
      "variable": "STRIPE_SECRET_KEY"
    }
  ],
  "last_used_at": "2026-10-23T14:04:00Z",
  "last_used_by_deployment_id": "dep_01jbx2m9k7q4r8t5v6w3y0z1dp",
  "decrypts_last_7_days": 14,
  "created_at": "2026-10-01T09:00:00Z",
  "updated_at": "2026-10-23T14:00:00Z"
}
```

## Used by

- [Set a secret (write-only)](/docs/api/secrets/#set-a-secret-write-only)
- [Get a secret's metadata](/docs/api/secrets/#get-a-secrets-metadata)
- [Rotate a secret to a new value](/docs/api/secrets/#rotate-a-secret-to-a-new-value)
