Skip to main content

Garnet API

Go client library and types for building runtime security monitoring and enforcement into your applications. Monitor events, manage agents, enforce network policies, and track issues across GitHub Actions and Kubernetes environments.

Quick Start

Get up and running with the Garnet API in minutes

1

Install the package

Add the Garnet API client to your Go project using go get:
go get github.com/garnet-org/api
2

Initialize the client

Create a new client instance with your API token. The client supports multiple authentication methods (user, agent, and project tokens):
package main

import (
    "github.com/garnet-org/api/client"
)

func main() {
    // Create client with user token
    c := client.New("https://api.garnet.ai", "your-token-here")

    // Or use specific token types
    c = c.WithUserToken("user-token")
    c = c.WithAgentToken("agent-token")
    c = c.WithProjectToken("project-token")
}
3

Make your first API call

Start interacting with the Garnet API. Here’s an example of listing agents:
import (
    "context"
    "fmt"
    "github.com/garnet-org/api/client"
    "github.com/garnet-org/api/types"
)

func main() {
    c := client.New("https://api.garnet.ai", "your-token")
    
    ctx := context.Background()
    agents, err := c.Agents(ctx, types.ListAgents{})
    if err != nil {
        panic(err)
    }
    
    fmt.Printf("Found %d agents\n", len(agents.Edges))
}
4

Explore the documentation

Dive deeper into specific features like event ingestion, issue management, and network policy enforcement. Check out our Core Concepts and API Reference sections.

Key Features

Everything you need for runtime security monitoring

Agent Management

Monitor and manage runtime security agents across GitHub Actions workflows and Kubernetes clusters

Event Ingestion

Ingest and query network flows, process executions, and file access events in real-time

Issue Tracking

Track security issues with allow/block actions and maintain audit history

Network Policies

Define and enforce network policies with rule-based access control

API Reference

Explore the complete API surface

Client

Client initialization and authentication

Agents

Agent lifecycle operations

Events

Event ingestion and retrieval

Issues

Issue management and actions

Network Policies

Policy and rule management

Webhooks

Webhook configuration

Authentication

Multiple authentication methods for different use cases

User Tokens

OAuth 2.0 authentication for user access

Agent Tokens

Limited access for agent operations

Project Tokens

Programmatic access to project resources

Ready to get started?

Follow our quickstart guide to start building runtime security monitoring into your applications in minutes.