{"id":19054220,"url":"https://github.com/datadog/datadog-api-client-go","last_synced_at":"2026-03-06T21:02:28.170Z","repository":{"id":36951250,"uuid":"193794016","full_name":"DataDog/datadog-api-client-go","owner":"DataDog","description":"Golang client for the Datadog API","archived":false,"fork":false,"pushed_at":"2025-05-12T17:55:12.000Z","size":199473,"stargazers_count":142,"open_issues_count":53,"forks_count":60,"subscribers_count":541,"default_branch":"master","last_synced_at":"2025-05-12T18:45:55.331Z","etag":null,"topics":["datadog","datadog-api","golang","openapi"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/DataDog/datadog-api-client-go/v2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataDog.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-25T22:56:03.000Z","updated_at":"2025-05-12T17:51:41.000Z","dependencies_parsed_at":"2023-10-02T18:17:25.067Z","dependency_job_id":"d15a69a6-e4ca-4bd1-b495-85e6bceef808","html_url":"https://github.com/DataDog/datadog-api-client-go","commit_stats":{"total_commits":2267,"total_committers":78,"mean_commits":"29.064102564102566","dds":0.2399647110719012,"last_synced_commit":"a9b5774e1721dda4c675f39af28914e883033a0d"},"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDog","download_url":"https://codeload.github.com/DataDog/datadog-api-client-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datadog","datadog-api","golang","openapi"],"created_at":"2024-11-08T23:37:11.067Z","updated_at":"2026-03-06T21:02:23.122Z","avatar_url":"https://github.com/DataDog.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datadog-api-client-go\n\nThis repository contains a Go API client for the [Datadog API](https://docs.datadoghq.com/api/).\n\n## Requirements\n\n- Go 1.22+\n\n## Layout\n\nThis repository contains per-major-version API client packages. Right\nnow, Datadog has two API versions, `v1`, `v2` and the common package.\n\n### The API v1 Client\n\nThe client library for Datadog API v1 is located in the `api/datadogV1` directory. Import it with\n\n```go\nimport \"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n```\n\n### The API v2 Client\n\nThe client library for Datadog API v2 is located in the `api/datadogV2` directory. Import it with\n\n```go\nimport \"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n```\n\n### The Datadog Package\n\nThe datadog package for Datadog API is located in the `api/datadog` directory. Import it with\n\n```go\nimport \"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n```\n\n## Getting Started\n\nHere's an example creating a user:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"os\"\n\n    \"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n    \"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n)\n\nfunc main() {\n    ctx := context.WithValue(\n        context.Background(),\n        datadog.ContextAPIKeys,\n        map[string]datadog.APIKey{\n            \"apiKeyAuth\": {\n                Key: os.Getenv(\"DD_CLIENT_API_KEY\"),\n            },\n            \"appKeyAuth\": {\n                Key: os.Getenv(\"DD_CLIENT_APP_KEY\"),\n            },\n        },\n    )\n\n    body := *datadogV2.NewUserCreateRequest(*datadogV2.NewUserCreateData(*datadogV2.NewUserCreateAttributes(\"jane.doe@example.com\"), datadogV2.UsersType(\"users\")))\n\n    configuration := datadog.NewConfiguration()\n    apiClient := datadog.NewAPIClient(configuration)\n    usersApi := datadogV2.NewUsersApi(apiClient)\n\n    resp, r, err := usersApi.CreateUser(ctx, body)\n    if err != nil {\n        fmt.Fprintf(os.Stderr, \"Error creating user: %v\\n\", err)\n        fmt.Fprintf(os.Stderr, \"Full HTTP response: %v\\n\", r)\n    }\n    responseData := resp.GetData()\n    fmt.Fprintf(os.Stdout, \"User ID: %s\", responseData.GetId())\n}\n```\n\nSave it to `example.go`, then run `go get github.com/DataDog/datadog-api-client-go/v2`.\nSet the `DD_CLIENT_API_KEY` and `DD_CLIENT_APP_KEY` to your Datadog\ncredentials, and then run `go run example.go`.\n\n### Unstable Endpoints\n\nThis client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints:\n\n```go\n    configuration.SetUnstableOperationEnabled(\"\u003cAPIVersion\u003e.\u003cOperationName\u003e\", true)\n```\n\nwhere `\u003cOperationName\u003e` is the name of the method used to interact with that endpoint. For example: `GetLogsIndex`, or `UpdateLogsIndex`\n\n### Changing Server\n\nWhen talking to a different server, like the `eu` instance, change the `ContextServerVariables`:\n\n```go\n    ctx = context.WithValue(ctx,\n        datadog.ContextServerVariables,\n        map[string]string{\n            \"site\": \"datadoghq.eu\",\n    })\n```\n\n### Disable compressed payloads\n\nIf you want to disable GZIP compressed responses, set the `compress` flag\non your configuration object:\n\n```go\n    configuration.Compress = false\n```\n\n### Enable requests logging\n\nIf you want to enable requests logging, set the `debug` flag on your configuration object:\n\n```go\n    configuration.Debug = true\n```\n\n### Enable retry\n\nIf you want to enable retry when getting status code `429` rate-limited or `5xx`, set `EnableRetry` to `true`\n\n```go\n    configuration.RetryConfiguration.EnableRetry = true\n```\n\nThe default max retry is `3`, you can change it with `MaxRetries`\n\n```go\n    configuration.RetryConfiguration.MaxRetries = 3\n```\n\n### Configure proxy\n\nIf you want to configure proxy, set env var `HTTP_PROXY`, and `HTTPS_PROXY` or set custom\n`HTTPClient` with proxy configured on configuration object:\n\n```go\n    proxyUrl, _ := url.Parse(\"http://127.0.0.1:80\")\n    configuration.HTTPClient = \u0026http.Client{\n        Transport: \u0026http.Transport{Proxy: http.ProxyURL(proxyUrl)}\n    }\n```\n\n### Pagination\n\nSeveral listing operations have a pagination method to help consume all the items available.\nFor example, to retrieve all your incidents:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n)\n\nfunc main() {\n\tctx := datadog.NewDefaultContext(context.Background())\n\tconfiguration := datadog.NewConfiguration()\n\tconfiguration.SetUnstableOperationEnabled(\"v2.ListIncidents\", true)\n\tapiClient := datadog.NewAPIClient(configuration)\n\tincidentsApi := datadogV2.NewIncidentsApi(apiClient)\n\n\tresp, _ := incidentsApi.ListIncidentsWithPagination(ctx, *datadog.NewListIncidentsOptionalParameters())\n\tfor paginationResult := range resp {\n\t\tif paginationResult.Error != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error when calling `IncidentsApi.ListIncidentsWithPagination`: %v\\n\", paginationResult.Error)\n\t\t}\n\t\tresponseContent, _ := json.MarshalIndent(paginationResult.Item, \"\", \"  \")\n\t\tfmt.Fprintf(os.Stdout, \"%s\\n\", responseContent)\n\t}\n\n}\n```\n\n### Encoder/Decoder\n\nBy default, datadog-api-client-go uses the Go standard library [`enconding/json`](https://pkg.go.dev/encoding/json) to encode and decode data. As an alternative users can opt in to use [`goccy/go-json`](https://github.com/goccy/go-json) by specifying the go build tag `goccy_gojson`.\n\nIn comparison, there was a significant decrease in cpu time with `goccy/go-json` with an increase in memory overhead. For further benchmark information, see [`goccy/go-json` benchmark](https://github.com/goccy/go-json#benchmarks) section.\n\n## Documentation\n\nDeveloper documentation for API endpoints and models is available on [Github pages](https://datadoghq.dev/datadog-api-client-go/pkg/github.com/DataDog/datadog-api-client-go/v2/).\nReleased versions are available on [pkg.go.dev](https://pkg.go.dev/github.com/DataDog/datadog-api-client-go/v2).\n\n## Contributing\n\nAs most of the code in this repository is generated, we will only accept PRs for files\nthat are not modified by our code-generation machinery (changes to the generated files\nwould get overwritten). We happily accept contributions to files that are not autogenerated,\nsuch as tests and development tooling.\n\n## Author\n\nsupport@datadoghq.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fdatadog-api-client-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatadog%2Fdatadog-api-client-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fdatadog-api-client-go/lists"}