Skip to main content
POST
/
auth
/
api_keys
Go (SDK)
package main

import(
	"context"
	"os"
	latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
	"github.com/latitudesh/latitudesh-go-sdk/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := latitudeshgosdk.New(
        latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
    )

    res, err := s.APIKeys.Create(ctx, components.CreateAPIKey{
        Data: &components.Data{
            Type: components.CreateAPIKeyTypeAPIKeys,
            Attributes: &components.CreateAPIKeyAttributes{
                Name: latitudeshgosdk.Pointer("App Token"),
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
{
  "data": {
    "id": "tok_ez2A3DVldnawP",
    "type": "api_keys",
    "attributes": {
      "name": "App Token",
      "token": "38d2bcabe06f43d93dc99c672a1b4ae2c5bc",
      "token_last_slice": "2c5bc",
      "api_version": "2023-06-01",
      "created_at": "2025-07-16T18:36:26+00:00",
      "updated_at": "2025-07-16T18:36:26+00:00",
      "last_used_at": null,
      "user": {
        "id": "user_W3oeKxYvbWIQlBGElMVWsrK2Qyw",
        "email": "[email protected]"
      }
    }
  },
  "meta": {}
}

Authorizations

Authorization
string
header
required

Body

data
object

Response

201 - application/vnd.api+json

Created

data
object