Skip to main content
POST
/
vault-forward
/
configs
/
{config_id}
/
authentications
Adds new Vault Forward authentication method
using RestSharp;


var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n  \"kind\": \"mle\",\n  \"display_name\": \"My Message Level Encryption\",\n  \"fields\": [\n    {\n      \"key\": \"private_key\",\n      \"value\": \"sk_test_26PHem9AhJZvU623DfE1x4sd\"\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);
package main

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

func main() {

	url := "https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications"

	payload := strings.NewReader("{\n  \"kind\": \"mle\",\n  \"display_name\": \"My Message Level Encryption\",\n  \"fields\": [\n    {\n      \"key\": \"private_key\",\n      \"value\": \"sk_test_26PHem9AhJZvU623DfE1x4sd\"\n    }\n  ]\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.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"kind\": \"mle\",\n  \"display_name\": \"My Message Level Encryption\",\n  \"fields\": [\n    {\n      \"key\": \"private_key\",\n      \"value\": \"sk_test_26PHem9AhJZvU623DfE1x4sd\"\n    }\n  ]\n}")
  .asString();
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications",
  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([
    'kind' => 'mle',
    'display_name' => 'My Message Level Encryption',
    'fields' => [
        [
                'key' => 'private_key',
                'value' => 'sk_test_26PHem9AhJZvU623DfE1x4sd'
        ]
    ]
  ]),
  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;
}
import requests

url = "https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications"

payload = {
    "kind": "mle",
    "display_name": "My Message Level Encryption",
    "fields": [
        {
            "key": "private_key",
            "value": "sk_test_26PHem9AhJZvU623DfE1x4sd"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    kind: 'mle',
    display_name: 'My Message Level Encryption',
    fields: [{key: 'private_key', value: 'sk_test_26PHem9AhJZvU623DfE1x4sd'}]
  })
};

fetch('https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
curl --request POST \
  --url https://api.sandbox.{id}.gr4vy.app/vault-forward/configs/{config_id}/authentications \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "kind": "mle",
  "display_name": "My Message Level Encryption",
  "fields": [
    {
      "key": "private_key",
      "value": "sk_test_26PHem9AhJZvU623DfE1x4sd"
    }
  ]
}
'
{
  "type": "vault-forward-config-authentication",
  "id": "faaad066-30b4-4997-a438-242b0752d7e1",
  "created_at": "2012-12-12T10:53:43+00:00",
  "updated_at": "2012-12-12T10:53:43+00:00",
  "kind": "mle",
  "label": "My MLE",
  "display_name": "My MLE",
  "fields": [
    {
      "key": "secret_key",
      "value": "sk_test_26PHem9AhJZvU623DfE1x4sd"
    }
  ],
  "creator": {
    "id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
    "name": "John L",
    "email_address": "john@example.com"
  }
}
{
  "type": "error",
  "code": "bad_request",
  "status": 400,
  "message": "Missing '****' field",
  "details": [
    {
      "location": "body",
      "type": "value_error.missing",
      "pointer": "/payment_method/number",
      "message": "field required"
    }
  ]
}
{
  "type": "error",
  "code": "unauthorized",
  "status": 401,
  "message": "No valid API authentication found",
  "details": []
}
{
  "type": "error",
  "code": "not_found",
  "status": 404,
  "message": "The resource could not be found",
  "details": []
}
This endpoint requires the vault-forward-authentications.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

config_id
string<uuid>
required

The ID of the Vault Forward configuration.

Example:

"46973e9d-88a7-44a6-abfe-be4ff0134ff4"

Body

application/json

Request body to create a Vault Forward authentication method.

kind
enum<string>
required

The kind of authentication to be used in a Vault Forward request.

Available options:
mle,
mtls,
signature
Example:

"mle"

display_name
string
required

A custom name for the authentication method. This will be shown in the Admin UI.

Required string length: 1 - 50
Example:

"My Message Level Encryption"

fields
object[]
required

A list of fields, each containing a key-value pair for each field defined by the definition for this authentication method.

Response

Returns the created Vault Forward authentication method.

A configured Vault Forward authentication method.

type
string
default:vault-forward-config-authentication

The type of this resource. It is always vault-forward-config-authentication.

Example:

"vault-forward-config-authentication"

id
string<uuid>

The ID of this Vault Forward authentication method.

Example:

"faaad066-30b4-4997-a438-242b0752d7e1"

created_at
string<date-time>

The date and time when this configuration was created.

Example:

"2012-12-12T10:53:43+00:00"

updated_at
string<date-time>

The date and time when this configuration was last updated.

Example:

"2012-12-12T10:53:43+00:00"

kind
enum<string>

The kind of authentication to be used in a Vault Forward request.

Available options:
mle,
mtls,
signature
Example:

"mle"

label
string

A label that describes this authentication method.

Example:

"My MLE"

display_name
string

The display name for this authentication method given when created.

Example:

"My MLE"

fields
object[]

A list of fields, each containing a key-value pair for each field configured for this authentication method. Fields marked as secret are not returned.

creator
object | null

The user who created the Vault Forward authentication method.