> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://uploadcare.com/docs/_mcp/server.

# Golang API Client

> Golang Uploadcare API client for Fast & Reliable File Uploads; File, Group, Project Operations; Video + Document Conversion & More.

Golang integration handles uploads and file operations by wrapping Uploadcare
[Upload API](https://uploadcare.com/docs/api/upload/) and [REST API](https://uploadcare.com/docs/api/rest/). This
comprehensive API client lets you use most of the Uploadcare features from within
your Golang app.

[GitHub →](https://github.com/uploadcare/uploadcare-go)

## Features

Uploading ([Upload API](https://uploadcare.com/docs/api/upload/)):

* Upload files from local storage and URLs (up to 5 TB)
* Multipart uploading for large files
* Uploading network to speed uploading jobs (like CDN)

File management ([REST API](https://uploadcare.com/docs/api/rest/)):

* Get file info and perform various operations (store/delete) with them
* Work with groups of files
* Get info about account project
* Manage webhooks
* Convert documents
* Encode and transform videos

Image processing ([URL API](https://uploadcare.com/docs/api/url/)):

* Compression
* Geometry
* Colors
* Definition
* Image and text overlays
* Rotations
* Recognition
* File info
* Proxy (fetch)

Security features:

* Secure authentication
* Secure uploads (signed uploads)
* Secure delivery (signed URLs)

## Requirements

Requires **Go 1.25** or later.

> **Note**
>
> **Note:** Upgrading from v1.x? Update all import paths from `github.com/uploadcare/uploadcare-go/...` to `github.com/uploadcare/uploadcare-go/v2/...`, then review the API changes below (client configuration, file ordering constants, and file info fields).

## Installation

Install uploadcare-go with:

```
go get -u -v github.com/uploadcare/uploadcare-go/v2/...
```

Then import it using:

```go
import (
	"github.com/uploadcare/uploadcare-go/v2/ucare"
	"github.com/uploadcare/uploadcare-go/v2/file"
	"github.com/uploadcare/uploadcare-go/v2/group"
	"github.com/uploadcare/uploadcare-go/v2/upload"
	"github.com/uploadcare/uploadcare-go/v2/conversion"
)
```

## Configuration

Creating a client:

```go
creds := ucare.APICreds{
	SecretKey: "your-project-secret-key",
	PublicKey: "your-project-public-key",
}

conf, err := ucare.NewConfig(creds, ucare.WithSignBasedAuthentication())
if err != nil {
	log.Fatalf("creating uploadcare config: %v", err)
}
client, err := ucare.NewClient(creds, conf)
if err != nil {
	log.Fatalf("creating uploadcare API client: %v", err)
}
```

## Usage example

For a comprehensive list of examples, check out the [Upload API](https://uploadcare.com/docs/api/upload/) documentation.

Getting a list of files:

```go
fileSvc := file.NewService(client)

listParams := file.ListParams{
	Stored:  ucare.Bool(true),
	OrderBy: ucare.String(file.OrderByUploadedAtAsc),
}

fileList, err := fileSvc.List(context.Background(), listParams)
if err != nil {
	// handle error
}

// getting IDs of the files
ids := make([]string, 0, 100)
for fileList.Next() {
	finfo, err :=  fileList.ReadResult()
	if err != nil {
		// handle error
	}

	ids = append(ids, finfo.ID)
}
```

Getting file info:

```go
fileID := ids[0]
finfo, err := fileSvc.Info(context.Background(), fileID, nil)
if err != nil {
	// handle error
}

if finfo.IsImage && finfo.ContentInfo != nil && finfo.ContentInfo.Image != nil {
	h := finfo.ContentInfo.Image.Height
	w := finfo.ContentInfo.Image.Width
	fmt.Printf("image size: %dx%d\n", h, w)
}
```

Uploading a file:

```go
f, err := os.Open("file.png")
if err != nil {
	// handle error
}

uploadSvc := upload.NewService(client)

params := upload.FileParams{
	Data:        f,
	Name:        f.Name(),
	ContentType: "image/png",
}
fID, err := uploadSvc.File(context.Background(), params)
if err != nil {
	// handle error
}
```

Searching files:

```go
fileSvc := file.NewService(client)

results, err := fileSvc.Search(context.Background(), file.SearchParams{
	Query: "invoice",
	Limit: ucare.Uint64(20),
})
if err != nil {
	// handle error
}

fmt.Printf("found %d matches\n", results.Total())
for results.Next() {
	match, err := results.ReadResult()
	if err != nil {
		// handle error
	}
	fmt.Println(match.ID, match.OriginalFileName)
}
```

Managing file tags:

```go
tagSvc := tag.NewService(client)

result, err := tagSvc.Update(context.Background(), fileID, tag.UpdateParams{
	Add:    []string{"featured"},
	Delete: []string{"draft"},
})
if err != nil {
	// handle error
}

fmt.Println("tags:", result.Tags)
```

## Full documentation

Read the full documentation on [GitHub](https://github.com/uploadcare/uploadcare-go).

## Related guides

* Integration with [Rust](/docs/integrations/rust/)