Table of documentation contents


A Go client library for Weaviate.

Installation and setup

To get the latest stable version of the Go client library, run the following:

# the latest version is v1.1.0 source can be found at
go get

This API client is compatible with Go 1.13.

You can use the client in your Go scripts as follows:

package main

import (

func GetSchema() {
    cfg := weaviate.Config{
        Host:   "localhost:8080",
		Scheme: "http",
    client := weaviate.New(cfg)

    schema, err := client.Schema().Getter().Do(context.Background())
    if err != nil {
    fmt.Printf("%v", schema)


Authentication can be added to the configuration of the client as follows:

token := &oauth2.Token{
    AccessToken:  "<token>",
    TokenType:   "Bearer",
cfg := weaviate.Config{
    Host:   "",
    Scheme: "https",
    ConnectionClient: oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(token)),
client := weaviate.New(cfg)


All RESTful endpoints and GraphQL functions references covered by the Go client, and explained on those reference pages in the code blocks.


Builder pattern

The Go client functions are designed with a ‘Builder pattern’. A pattern is used to build complex query objects. This means that a function (for example to retrieve data from Weaviate with a request similar to a RESTful GET request, or a more complex GraphQL query) is built with single objects to reduce complexity. Some builder objects are optional, others are required to perform specific functions. All is documented on the RESTful API reference pages and the GraphQL reference pages.

The code snippet above shows a simple query similar to RESTful GET /v1/schema. The client is initiated with requiring the package and connecting to the running instance. Then, a query is constructed with getting the .Schema with .Getter(). The query will be sent with the .Go() function, this object is thus required for every function you want to build and execute.

More Resources

If you can’t find the answer to your question here, please look at the:

  1. Frequently Asked Questions. Or,
  2. Knowledge base of old issues. Or,
  3. For questions: Stackoverflow. Or,
  4. For issues: Github. Or,
  5. Ask your question in the Slack channel: Slack.
  • go
  • client library