# Programmatic Access to APIs

> Octelium documentation. Canonical page: <https://octelium.com/docs/octelium/latest/guide/developer/api>.

Octelium APIs are all developed as [gRPC](https://grpc.io/). Currently the Golang implementation is officially supported and it uses the same compiled code in the Octelium project. Here is a simple example:

```go
package main

import (
	"context"
	"crypto/tls"
	"fmt"
	"io"
	"net/http"
	"os"

	"github.com/octelium/octelium/apis/clusterv1"
	"github.com/octelium/octelium/apis/corev1"
	"github.com/octelium/octelium/apis/userv1"
	"github.com/octelium/octelium/octelium-go"
)

func main() {
	if err := doMain(context.Background()); err != nil {
		panic(err)
	}
}

func doMain(ctx context.Context) error {
	octeliumC, err := octelium.NewClient(ctx, &octelium.ClientConfig{
		Domain:    "example.com",
		AuthToken: os.Getenv("OCTELIUM_AUTH_TOKEN"),
	})
	if err != nil {
		return err
	}

	defer octeliumC.Close()

	grpcConn, err := octeliumC.GetGRPCClient(ctx)
	if err != nil {
		return err
	}

	{
		c := userv1.NewMainServiceClient(grpcConn)

		itemList, err := c.GetStatus(ctx, &userv1.GetStatusRequest{})
		if err != nil {
			return err
		}

		fmt.Printf("%+v\n", itemList)
	}

	{
		c := corev1.NewMainServiceClient(grpcConn)

		itemList, err := c.ListService(ctx, &corev1.ListServiceOptions{})
		if err != nil {
			return err
		}

		fmt.Printf("%+v\n", itemList)
	}

	{
		c := clusterv1.NewMainServiceClient(grpcConn)

		cc, err := c.GetClusterConfig(ctx, &clusterv1.GetClusterConfigRequest{})
		if err != nil {
			return err
		}

		fmt.Printf("%+v\n", cc)
	}

	{
		accessToken, err := octeliumC.GetAccessToken(ctx)
		if err != nil {
			return err
		}

		req, err := http.NewRequest("GET", "https://nginx.octelium.org", nil)
		if err != nil {
			return err
		}

		req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", accessToken))
		req.Header.Set("Content-Type", "application/json")

		httpC := &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
			},
		}

		resp, err := httpC.Do(req)
		if err != nil {
			return err
		}
		defer resp.Body.Close()

		res, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		fmt.Println(string(res))
	}

	return nil
}
```
