Version 1.0.0
GitHub
Get Support

Secrets API Reference

The Secrets API allows you to programmatically manage secrets for your Neo Service Layer account.

Information

This is a basic version of the Secrets API documentation. It will be expanded with more detailed content in future updates.

API Overview

The Secrets API provides endpoints for creating, retrieving, updating, and deleting secrets. Secrets are sensitive pieces of information like API keys, credentials, or configuration values that are stored securely and can be accessed by your functions running in the TEE.

Base URL

1https://api.neoservicelayer.com/v1/secrets

Endpoints

List Secrets

Retrieves a list of secrets in your account, without their values.

GET /secrets

Example Request

1curl -X GET "https://api.neoservicelayer.com/v1/secrets" \
2  -H "Authorization: Bearer YOUR_API_KEY"

Response

1{
2  "secrets": [
3    {
4      "id": "sec_123456789",
5      "name": "database-password",
6      "createdAt": "2023-03-15T10:30:45Z",
7      "updatedAt": "2023-03-15T10:30:45Z"
8    },
9    {
10      "id": "sec_987654321",
11      "name": "api-key",
12      "createdAt": "2023-03-10T15:20:30Z",
13      "updatedAt": "2023-03-12T09:15:22Z"
14    }
15  ],
16  "pagination": {
17    "total": 2,
18    "limit": 20,
19    "offset": 0
20  }
21}

Create Secret

Creates a new secret in your account.

Warning

The secret value is only transmitted over HTTPS and is encrypted at rest. For maximum security, consider rotating your secrets regularly.

POST /secrets

Request Body

1{
2  "name": "api-key",
3  "value": "YOUR_SECRET_VALUE",
4  "description": "API key for external service"
5}

Example Request

1curl -X POST "https://api.neoservicelayer.com/v1/secrets" \
2  -H "Authorization: Bearer YOUR_API_KEY" \
3  -H "Content-Type: application/json" \
4  -d '{
5    "name": "api-key",
6    "value": "YOUR_SECRET_VALUE",
7    "description": "API key for external service"
8  }'

Response

1{
2  "id": "sec_123456789",
3  "name": "api-key",
4  "description": "API key for external service",
5  "createdAt": "2023-03-15T10:30:45Z",
6  "updatedAt": "2023-03-15T10:30:45Z"
7}

Delete Secret

Permanently deletes a secret from your account.

Warning: Irreversible Action

Deleting a secret is permanent and cannot be undone. Make sure no functions or automations are using the secret before deleting it.

DELETE /secrets/{secretId}

Path Parameters

  • secretId (required) - The ID of the secret to delete

Example Request

1curl -X DELETE "https://api.neoservicelayer.com/v1/secrets/sec_123456789" \
2  -H "Authorization: Bearer YOUR_API_KEY"

Response

1{
2  "success": true,
3  "message": "Secret deleted successfully"
4}

Using Secrets in Functions

Once you've created a secret, you can access it within your functions using the secrets object:

1async function main(context) {
2  // Access a stored secret
3  const apiKey = await context.secrets.get('api-key');
4  
5  // Use the secret in your function
6  // ...
7  
8  return { success: true };
9}

For more information on using secrets in your functions, see the Managing Secrets Guide.

Error Codes

Status CodeError CodeDescription
400INVALID_REQUESTThe request was invalid or missing required parameters
401UNAUTHORIZEDInvalid or missing API key
403FORBIDDENInsufficient permissions to perform the operation
404NOT_FOUNDThe requested secret was not found
409CONFLICTA secret with the same name already exists

Was this page helpful?

Edit this page on GitHub