GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cloudinary/cloudinary-go: Cloudinary Golang package

BranchesTags
Open more actions menu

Latest commit

 

History

187 Commits
187 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
api
api
 
 
asset
asset
 
 
config
config
 
 
docs
docs
 
 
examples
examples
 
 
gen/generate_setters
gen/generate_setters
 
 
internal
internal
 
 
logger
logger
 
 
scripts
scripts
 
 
transformation
transformation
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
TEST.md
TEST.md
 
 
cloudinary.go
cloudinary.go
 
 
cloudinary_test.go
cloudinary_test.go
 
 
context7.json
context7.json
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 

Repository files navigation

Tests Go Report Card PkgGoDev License

Cloudinary Go SDK

Upload, transform, optimize, and manage images and videos with Cloudinary from Go — the cloudinary-go module.

Install

go get github.com/cloudinary/cloudinary-go/v2

Quick start

Set your API environment variable (Console > Settings > API Keys):

export CLOUDINARY_URL=cloudinary://<api_key>:<api_secret>@<cloud_name>

Upload an image and get an optimized delivery URL:

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/cloudinary/cloudinary-go/v2"
	"github.com/cloudinary/cloudinary-go/v2/api/uploader"
)

func main() {
	if err := run(); err != nil {
		fmt.Fprintln(os.Stderr, "Quick start failed:", err)
		fmt.Fprintln(os.Stderr, "Check that CLOUDINARY_URL is set (Console > Settings > API Keys).")
		os.Exit(1)
	}
}

func run() error {
	cld, err := cloudinary.New()
	if err != nil {
		return err
	}
	ctx := context.Background()

	// Upload a remote image (a local file path works the same way).
	result, err := cld.Upload.Upload(ctx,
		"https://res.cloudinary.com/demo/image/upload/sample.jpg",
		uploader.UploadParams{PublicID: "quickstart-sample"})
	if err != nil {
		return err
	}
	if result.Error.Message != "" {
		// Cloudinary rejected the request; this arrives with err == nil.
		return fmt.Errorf("upload rejected: %s", result.Error.Message)
	}
	fmt.Println("Uploaded:", result.PublicID)

	// Build a 400x400 auto-cropped URL with automatic format and quality.
	image, err := cld.Image(result.PublicID)
	if err != nil {
		return err
	}
	image.Transformation = "c_fill,g_auto,h_400,w_400/f_auto,q_auto"
	url, err := image.String()
	if err != nil {
		return err
	}
	fmt.Println("Optimized URL:", url)
	return nil
}

Save as quickstart.go and run go run quickstart.go. Create a free account if you don't have one — or run npx @cloudinary/cloud to provision one without signing up.

Note the two checks in run: err reports transport, context, and decoding failures, while a Cloudinary rejection arrives with err == nil and a populated result.Error.Message. See Handle errors.

Common tasks

  • Get Cloudinary credentials
  • Import and call the SDK
  • Configure Cloudinary
  • Upload an image
  • Upload a large video
  • Sign a browser upload
  • Transform and deliver an image
  • Transform and deliver a video
  • Search and manage assets
  • Moderate an upload
  • Use structured metadata
  • Serve uploads over HTTP
  • Handle errors
  • Troubleshoot errors

Runnable versions live in examples/ — each is a complete program you can run directly. It is a nested module, so run them from inside examples/.

When to use this SDK

Use this module in Go server-side code: uploads, signed operations, asset administration, search, moderation, and delivery URL generation.

For other jobs, better-fitting tools exist:

  • Browser or frontend framework rendering: the frontend SDKs (md) — this module generates URLs, not markup.
  • Complete in-browser upload UI: Upload Widget (md), signed from Go with Sign a browser upload.
  • Video playback UI: Cloudinary Video Player (md).
  • Text-to-image generation and image-to-video: platform APIs (md), not wrapped by this module.
  • Account and sub-account provisioning: Provisioning API (md) over HTTP.
  • Multi-step media workflow automation: MediaFlows (md).
  • Interactive agent-driven asset operations: Cloudinary MCP servers and Skills (md).

The full capability map — plus the Skills, MCP servers, and CLI worth setting up first — is in docs/platform-capabilities.md.

Status and compatibility

Stable, actively maintained. See CHANGELOG.md.

SDK version Go 1.13 - 1.19 Go 1.20 - 1.23 Go 1.24 - 1.27
2.8 and up ❌ ✔️ ✔️
2.7 ✔️ ✔️ ✔️
1.x ✔️ ✔️ ✔️

Documentation

  • Bundled task docs — ship inside the module, version-matched.
  • Go SDK guide — the full documentation (md).
  • Logging — redefining the logger and adjusting the log level.

Documentation links in this README point at the browsable HTML page, with an (md) companion link that returns the same page as raw Markdown. Inside docs/ and examples/ the links are Markdown-only, since those files are written to be read by coding agents. Either form works for any page: add .md for Markdown, drop it for HTML.

For AI coding agents

  • Contributing to this repo: read AGENTS.md.
  • Using the installed module: the docs bundled in the module match your resolved version and are the source of truth; start with platform-capabilities before assuming a feature exists.

Go has no fixed install path, so locate the bundled docs with:

go list -m -f '{{.Dir}}' github.com/cloudinary/cloudinary-go/v2
# then read <that path>/docs/README.md

Support

  • SDK bugs and feature requests: GitHub issues
  • Account and platform questions: Cloudinary support

Contributing: see CONTRIBUTING.md.

Security

See SECURITY.md for private vulnerability reporting. Keep your api_secret in server-side code; for client uploads, use the server-signed pattern in Sign a browser upload.

License

Released under the MIT license — see LICENSE. Copyright (c) Cloudinary Ltd.

About

Cloudinary Golang package

Topics

cloudinarycloudinary-apicloudinary-gocloudinary-sdkgo-sdkgolanghacktoberfest

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

51 stars

Watchers

21 watching

Forks

25 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.