Create Logger API Key

Create a new API key for a logger. API keys allow management access to the logger.

Authentication

Requires management credentials:

  • Api-Key — Your API key
  • Api-Secret — Your API secret

Path Parameters

Parameter Description
id The unique identifier of the logger

Request Body

Field Type Required Description
name string yes A label to identify this API key
1{
2  "name": "ci-cd-key"
3}

Request

curl -X POST "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys" \
  -H "Api-Key: LOGGER_API_KEY" \
  -H "Api-Secret: LOGGER_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ci-cd-key"
  }'
POST /v1/loggers/logger_xyz789/apiKeys HTTP/1.1
Host: api.hola.cloud
Api-Key: LOGGER_API_KEY
Api-Secret: LOGGER_API_SECRET
Content-Type: application/json

{
    "name": "ci-cd-key"
  }
package main

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

func main() {
	payload := map[string]any{"name": "ci-cd-key"}
	bodyBytes, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}
	body := string(bodyBytes)

	req, err := http.NewRequest("POST", "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", strings.NewReader(body))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Api-Key", "LOGGER_API_KEY")
	req.Header.Set("Api-Secret", "LOGGER_API_SECRET")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(responseBody))
}
<?php
$payload = ['name' => 'ci-cd-key'];
$body = json_encode($payload);

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_HTTPHEADER => [
        'Api-Key: LOGGER_API_KEY',
        'Api-Secret: LOGGER_API_SECRET',
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
curl_close($ch);

echo $response;
import requests

import json

headers = {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json",
}

payload = {"name": "ci-cd-key"}
body = json.dumps(payload)

response = requests.request(
    "POST",
    "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys",
    headers=headers,
    data=body
)

print(response.text)
const payload = {"name": "ci-cd-key"};

const response = await fetch("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", {
  method: "POST",
  headers: {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

console.log(await response.text());
const payload = {"name": "ci-cd-key"};

const response = await fetch("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", {
  method: "POST",
  headers: {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;

public class Main {
    public static void main(String[] args) throws Exception {
        var payload = Map.of("name", "ci-cd-key");
        var body = new ObjectMapper().writeValueAsString(payload);

        var request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys"))
            .method("POST", HttpRequest.BodyPublishers.ofString(body))
            .header("Api-Key", "LOGGER_API_KEY")
            .header("Api-Secret", "LOGGER_API_SECRET")
            .header("Content-Type", "application/json")
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
curl -X POST "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys" \
  -H "Api-Key: LOGGER_API_KEY" \
  -H "Api-Secret: LOGGER_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "ci-cd-key"
}'
POST /v1/loggers/logger_xyz789/apiKeys HTTP/1.1
Host: api.hola.cloud
Api-Key: LOGGER_API_KEY
Api-Secret: LOGGER_API_SECRET
Content-Type: application/json

{
  "name": "ci-cd-key"
}
package main

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

func main() {
	payload := map[string]any{"name": "ci-cd-key"}
	bodyBytes, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}
	body := string(bodyBytes)

	req, err := http.NewRequest("POST", "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", strings.NewReader(body))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Api-Key", "LOGGER_API_KEY")
	req.Header.Set("Api-Secret", "LOGGER_API_SECRET")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(responseBody))
}
<?php
$payload = ['name' => 'ci-cd-key'];
$body = json_encode($payload);

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_HTTPHEADER => [
        'Api-Key: LOGGER_API_KEY',
        'Api-Secret: LOGGER_API_SECRET',
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
curl_close($ch);

echo $response;
import requests

import json

headers = {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json",
}

payload = {"name": "ci-cd-key"}
body = json.dumps(payload)

response = requests.request(
    "POST",
    "https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys",
    headers=headers,
    data=body
)

print(response.text)
const payload = {"name": "ci-cd-key"};

const response = await fetch("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", {
  method: "POST",
  headers: {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

console.log(await response.text());
const payload = {"name": "ci-cd-key"};

const response = await fetch("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys", {
  method: "POST",
  headers: {
    "Api-Key": "LOGGER_API_KEY",
    "Api-Secret": "LOGGER_API_SECRET",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;

public class Main {
    public static void main(String[] args) throws Exception {
        var payload = Map.of("name", "ci-cd-key");
        var body = new ObjectMapper().writeValueAsString(payload);

        var request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.hola.cloud/v1/loggers/logger_xyz789/apiKeys"))
            .method("POST", HttpRequest.BodyPublishers.ofString(body))
            .header("Api-Key", "LOGGER_API_KEY")
            .header("Api-Secret", "LOGGER_API_SECRET")
            .header("Content-Type", "application/json")
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

Response

1{
2  "id": "ak_123456",
3  "name": "ci-cd-key",
4  "key": "lgs_api_key_value",
5  "created_at": "2025-06-20T15:00:00Z"
6}

Error Codes

Code Description
400 Missing or invalid name field
401 Missing or invalid API credentials
403 API credentials do not have access to this logger
404 Logger not found

Comments

Leave a comment