Skip to main content
POST
/
v1beta
/
secrets
JavaScript
import Indices from 'indicesio';

const client = new Indices({
  apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
});

const secret = await client.secrets.create({ name: 'name', secret_type: 'login' });

console.log(secret.id);
import os
from indices import Indices

client = Indices(
api_key=os.environ.get("INDICES_API_KEY"), # This is the default and can be omitted
)
secret = client.secrets.create(
name="name",
secret_type="login",
)
print(secret.id)
curl --request POST \
--url https://api.indices.io/v1beta/secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"username": "<string>",
"password": "<string>",
"totp_secret": "<string>",
"value": "<string>",
"website": "<string>"
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.indices.io/v1beta/secrets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'username' => '<string>',
'password' => '<string>',
'totp_secret' => '<string>',
'value' => '<string>',
'website' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.indices.io/v1beta/secrets"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\",\n \"totp_secret\": \"<string>\",\n \"value\": \"<string>\",\n \"website\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.indices.io/v1beta/secrets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\",\n \"totp_secret\": \"<string>\",\n \"value\": \"<string>\",\n \"website\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.indices.io/v1beta/secrets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\",\n \"totp_secret\": \"<string>\",\n \"value\": \"<string>\",\n \"website\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "website": "<string>",
  "has_totp": true,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

Enter your API key as the bearer token. Set header: Authorization to Bearer <api_key>

Body

application/json
name
string
required

Human-readable name for the secret.

secret_type
enum<string>
required

Type of secret: 'login' for credentials, 'string' for simple values.

Available options:
login,
string
username
string | null

Login username. Required for 'login' type.

password
string | null

Login password. Required for 'login' type.

totp_secret
string | null

Optional TOTP secret (base32 encoded). Only for 'login' type.

value
string | null

Secret value. Required for 'string' type.

website
string | null

Optional website URL for context.

Response

Successful response

id
string
required

Unique identifier for the secret.

name
string
required

Human-readable name for the secret.

secret_type
enum<string>
required

Type of secret: 'login' or 'string'.

Available options:
login,
string
website
string | null
required

Optional website URL.

has_totp
boolean
required

Whether the secret has a TOTP configured (only applicable for login type).

created_at
string<date-time>
required

Timestamp when the secret was created.

updated_at
string<date-time>
required

Timestamp when the secret was last updated.