---
title: "Golang & Python SDKs | Phase Changelog"
description: "Securely manage your application secrets programmatically with our new Golang and Python SDKs"
url: https://phase.dev/changelog/golang-python-sdk/
---

[Changelog](https://phase.dev/changelog/)

2024.08.22

# Golang & Python SDKs

Securely manage your application secrets programmatically with our new Golang and Python SDKs

[sdk](https://phase.dev/changelog/tag/sdk/)[golang](https://phase.dev/changelog/tag/golang/)[python](https://phase.dev/changelog/tag/python/)

We're excited to announce the release of native Golang and Python SDKs for Phase. These SDKs allow you to programmatically manage your application secrets with end-to-end encryption straight from your code.

* * *

## SDK Features

Both SDKs offer a comprehensive set of features for managing secrets:

-   Create, read, update, and delete (CRUD) operations for secrets
-   End-to-end encryption
-   Full secret referencing
-   Bulk operations

Let's dive into some code examples to see these SDKs in action.

## Golang SDK

### Installation

First, install the SDK using `go get`:

```fish
go get github.com/phasehq/golang-sdk/phase
```

### Usage Examples

Initialize the SDK:

```go
phaseClient := phase.Init(serviceToken, "https://console.phase.dev", debug=false)
```

Create a secret:

```go
opts := phase.CreateSecretsOptions{
    KeyValuePairs: []map[string]string{
        {"API_KEY": "my_secret_api_key"},
    },
    EnvName:    "Production",
    AppName:    "MyApp",
    SecretPath: map[string]string{"API_KEY": "/api/keys"},
}

err := phaseClient.Create(opts)
```

Retrieve a secret:

```go
getOpts := phase.GetSecretOptions{
    EnvName:   "Production",
    AppName:   "MyApp",
    KeyToFind: "API_KEY",
}

secret, err := phaseClient.Get(getOpts)
```

Delete a secret:

```go
deleteOpts := phase.DeleteSecretOptions{
    EnvName:     "Production",
    AppName:     "MyApp",
    KeyToDelete: "API_KEY",
    SecretPath:  "/api/keys",
}

err := phaseClient.Delete(deleteOpts)
```

## Python SDK

### Installation

Install the SDK using pip:

```fish
pip install phase-dev
```

### Usage Examples

Initialize the SDK:

```python
from phase import Phase

phase = Phase(
    host='https://console.phase.dev',
    pss=PHASE_SERVICE_TOKEN
)
```

Create secrets (bulk operation):

```python
from phase import CreateSecretsOptions

create_options = CreateSecretsOptions(
    env_name="Development",
    app_name="MyApp",
    key_value_pairs=[
        {"API_KEY": "my_secret_api_key"},
        {"DB_PASSWORD": "super_secret_password"}
    ],
    secret_path="/api"
)
result = phase.create_secrets(create_options)
```

Retrieve all secrets:

```python
from phase import GetAllSecretsOptions

get_options = GetAllSecretsOptions(
    env_name="Development",
    app_name="MyApp",
    tag="api",  # Optional: filter by tag
    secret_path="/api"
)
secrets = phase.get_all_secrets(get_options)
```

Delete a secret:

```python
from phase import DeleteSecretOptions

delete_options = DeleteSecretOptions(
    env_name="Development",
    app_name="MyApp",
    key_to_delete="API_KEY",
    secret_path="/api"
)
result = phase.delete_secret(delete_options)
```

## Secret Referencing

Both SDKs support secret referencing, allowing you to set the value of one secret to that of another. This is particularly useful for maintaining consistency across environments and avoiding repetition.

* * *

These new SDKs provide a powerful and flexible way to manage your application secrets programmatically. Whether you're working with Go or Python, you can now easily integrate Phase into your development workflow, ensuring that your secrets are always securely stored and easily accessible.

For more detailed information and additional features, please refer to the full documentation for the [Golang SDK](https://docs.phase.dev/sdks/go) and [Python SDK](https://docs.phase.dev/sdks/python).

As always, we welcome your feedback and contributions. If you encounter any issues or have suggestions for improvements, please don't hesitate to reach out on our [GitHub repository](https://github.com/phasehq) or [Slack community](https://slack.phase.dev).

RoadmapCommunity-driven

Request a feature

We build features based on community requests and feedback. Looking for a specific feature or have a use-case in mind? Reach out to us.

[Feature request](https://github.com/phasehq/console/issues/new?template=feature_request.md)

DeploymentSelf-hosted / Cloud

Get started

## Keep your secrets

Self-host or start on fully managed Cloud in under a minute.

Self-hosted

Run Phase on your own infrastructure. Free and open source.

AI agent deployment skill

[![Docker Compose logo](https://phase.dev/assets/images/docker.svg)](https://docs.phase.dev/self-hosting/docker-compose)[![Kubernetes logo](https://phase.dev/assets/images/kubernetes.svg)](https://docs.phase.dev/self-hosting/kubernetes)[![AWS logo](https://phase.dev/assets/images/aws.svg)](https://docs.phase.dev/self-hosting/aws-eks)[![GCP logo](https://phase.dev/assets/images/gcp.svg)](https://docs.phase.dev/self-hosting/gcp)[![Azure logo](https://phase.dev/assets/images/azure.svg)](https://docs.phase.dev/self-hosting/azure)[![Railway logo](https://phase.dev/assets/images/railway.svg)](https://docs.phase.dev/self-hosting/railway)[![Raspberry Pi logo](https://phase.dev/assets/images/raspberry.svg)](https://docs.phase.dev/self-hosting/raspberrypi)

[Self-hosting guide](https://docs.phase.dev/self-hosting)

Cloud

Fully managed. From signup to your first secret in 60 seconds.

Sign up with

[Google](https://console.phase.dev/login?provider=google)[GitHub](https://console.phase.dev/login?provider=github)[GitLab](https://console.phase.dev/login?provider=gitlab)
