# Client Libraries

> Official Onetime Secret SDKs for JavaScript, Kotlin, PowerShell, Python, Ruby, Rust, and Swift, plus community-maintained client libraries.

Use these client libraries to call the Onetime Secret API from your application or scripts.

## Official client libraries

These libraries are maintained by Onetime Secret. Follow each SDK’s documentation for installation and usage. Check [package availability](#package-verification) before installing an SDK. The identifiers below come from each repository’s manifest and can differ from its name.

Each official SDK supports API v2 and lets you choose a [regional API host](/en/security/where-your-data-lives/) or a self-hosted base URL. API and host support were checked against the SDK READMEs on 2026-11-02.

For a language-independent API v2 example, use the [HTTP quick start](/en/api/#quick-start).

### JavaScript / TypeScript SDK

Package identifier (npm): `@onetimesecret/sdk`

[onetimesecret-js](https://github.com/onetimesecret/onetimesecret-js)

[Quick start](https://github.com/onetimesecret/onetimesecret-js/blob/main/README.md#quick-start)

### Kotlin SDK

Artifact identifier (Maven): `com.onetimesecret:onetimesecret-kotlin`

[onetimesecret-kotlin](https://github.com/onetimesecret/onetimesecret-kotlin)

[Quick start](https://github.com/onetimesecret/onetimesecret-kotlin/blob/main/README.md#quick-start)

### PowerShell SDK

Module: `OnetimeSecret`

[onetimesecret-powershell](https://github.com/onetimesecret/onetimesecret-powershell)

[Quick start](https://github.com/onetimesecret/onetimesecret-powershell/blob/main/README.md#quick-start) · [Installation](https://github.com/onetimesecret/onetimesecret-powershell/blob/main/README.md#installation)

### Python SDK

Package identifier (PyPI): `onetime-secret`; import: `onetimesecret`

[onetimesecret-py](https://github.com/onetimesecret/onetimesecret-py)

[Quick start](https://github.com/onetimesecret/onetimesecret-py/blob/main/README.md#quick-start)

### Ruby SDK

RubyGems: `onetimesecret`

[onetimesecret-ruby](https://github.com/onetimesecret/onetimesecret-ruby)

[Quick start](https://github.com/onetimesecret/onetimesecret-ruby/blob/main/README.md#quick-start)

### Rust SDK

Crate identifier: `onetimesecret`

[onetimesecret-rust](https://github.com/onetimesecret/onetimesecret-rust)

[Quick start](https://github.com/onetimesecret/onetimesecret-rust/blob/main/README.md#use)

### Swift (Apple platforms and Linux) SDK

SwiftPM product: `OnetimeSecret`

[onetimesecret-ios](https://github.com/onetimesecret/onetimesecret-ios)

[Quick start](https://github.com/onetimesecret/onetimesecret-ios/blob/main/README.md#usage) · [Installation](https://github.com/onetimesecret/onetimesecret-ios/blob/main/README.md#installation)

## Package verification

Availability checked on 2026-11-02: no public registry listings were found for the JavaScript, Kotlin, Python or Rust packages. The Ruby gem was available; PowerShell Gallery availability of the official module was not verified. Swift installs from its Git repository through Swift Package Manager.

## Community-maintained libraries

The libraries below are **community-maintained**. Most of these libraries predate API v2 and the regional domains, so they typically call the deprecated v1 endpoints against `onetimesecret.com` — check each entry’s status note, and verify a library works against your region or self-hosted instance before depending on it.

| Language   | Library                                                               | Last activity¹ | Regional / custom domain |
| ---------- | --------------------------------------------------------------------- | -------------- | ------------------------ |
| Go         | [go-onetimesecret](https://github.com/corbaltcode/go-onetimesecret)   | 2026-05        | US host                  |
| Python     | [onetimesecret-cli](https://github.com/slashpass/onetimesecret-cli)   | 2024-11        | US / EU region option    |
| Go         | [otsgo](https://github.com/emdneto/otsgo)                             | 2024-03        | not documented           |
| PowerShell | [OneTimeSecret](https://github.com/chelnak/OneTimeSecret)             | 2021-06        | custom base URL          |
| Bash       | [onetimesecret-bash](https://github.com/eengstrom/onetimesecret-bash) | 2020-05        | custom host              |
| Python     | [py_onetimesecret](https://github.com/utterstep/py_onetimesecret)     | 2019-05        | ❌ (Python 2-era)         |
| C#         | [OneTimeSharp](https://github.com/utterstep/OneTimeSharp)             | 2018-05        | ❌                        |
| Java       | [onetime-java](https://github.com/mpawlowski/onetime-java)            | 2014-06        | self-hosted URL only     |
| Perl       | [Net::OneTimeSecret](https://metacpan.org/pod/Net::OneTimeSecret)     | 2012-02        | ❌                        |

¹ Activity dates and compatibility notes reflect the last community-library audit in 2026-07. They were not re-audited for this official SDK update.

### Python

[GitHub page - onetimesecret-cli](https://github.com/slashpass/onetimesecret-cli) by [slashpass](https://github.com/slashpass) — community-maintained (last commit 2024-11). Supports a region option (`us` / `eu`).

For new Python integrations, choose an official SDK from the [SDKs above](#official-client-libraries). The following examples use community packages.

#### onetimesecret-cli example

```python
from onetimesecret import OneTimeSecretCli


cli = OneTimeSecretCli(ONETIMESECRET_USER, ONETIMESECRET_KEY)
cli.create_link("secret") # return a link like https://onetimesecret.com/secret/xxxxxxxxxxx
```

[GitHub page - py_onetimesecret](https://github.com/utterstep/py_onetimesecret) by [Vladislav Stepanov](https://github.com/utterstep) — **unmaintained** (last commit 2019; the example below is Python 2). Uses the deprecated v1 API against `onetimesecret.com` only.

#### py_onetimesecret example

```python
from onetimesecret import OneTimeSecret


o = OneTimeSecret("YOUR_EMAIL", "YOUR_OTS_APIKEY")
secret = o.share(u"test")


print o.retrieve_secret(secret["secret_key"])
# {u'secret_key': u'dtr7ixukiolpx1i4i87kahmhyoy2q65',
# u'value': u'test'}
```

***

### Perl

[Net::OneTimeSecret on CPAN](https://metacpan.org/pod/Net::OneTimeSecret) by [Kyle Dawkins](http://www.shoffle.com/) — **unmaintained** (last release 0.04, 2012-02). Predates API v2 and regional domains.

#### Net::OneTimeSecret example

```perl
#!/usr/bin/env perl


use Net::OneTimeSecret;


# Note: replace these with yours in order for this to work!
my $customerId  = 'YOUR_EMAIL';
my $testApiKey  = 'YOUR_OTS_APIKEY';


my $api = Net::OneTimeSecret->new( $customerId, $testApiKey );
my $result = $api->shareSecret( 'Jazz, jazz and more jazz.',
                   passphrase => 'thepassword',
                   recipient => 'kyle@shoffle.com',
                   ttl => 7200,
                 );
printf( "%s\n", $result->{secret_key} );


my $secret = $api->retrieveSecret( $result->{secret_key}, passphrase => "thepassword" );
printf( "%s\n", $secret->{value} );
```

***

### Java

[GitHub page - onetime-java](https://github.com/mpawlowski/onetime-java) by [Marcin Pawlowski](https://github.com/mpawlowski) — **unmaintained** (last commit 2014-06). Takes an instance URL, so it may work self-hosted, but it predates API v2.

#### onetime-java example

```java
OneTimeSecret ots = new OneTimeSecretRestImpl(
    "https://path/to/ots/instance",
    "ots-username",
    "ots-apikey");


GenerateResponse generateResponse = ots.generate(
                new GenerateRequest.Builder()
                        .withPassphrase("supersecret")
                        .build());


RetrieveResponse retrieveResponse = ots.retrieve(
                new RetrieveRequest.Builder()
                        .withSecretKey(generateResponse.getSecretKey())
                        .withPassphrase("supersecret")
                        .build());


assertEquals(generateResponse.getValue(), retrieveResponse.getValue());
```

***

### C\#

[GitHub page - OneTimeSharp](https://github.com/utterstep/OneTimeSharp) by [Vladislav Stepanov](https://github.com/utterstep) — **unmaintained** (last commit 2018-05). Uses the deprecated v1 API against `onetimesecret.com` only.

#### OneTimeSharp example

```csharp
// You can use OneTimeSharp in any of your projects which are compatible with .NET (4.0+) or Mono (2.10.8+).
using VStepanov.OneTimeSharp;


class Test
{
    static void Main(string[] args)
    {
        var ots = new OneTimeSecret("YOUR_EMAIL", "YOUR_OTS_APIKEY");


        var generated = ots.GenerateSecret();


        Console.WriteLine(generated.Value); // LR*?us*A(UT*


        Console.WriteLine(generated.SecretKey); // ikzx3m77j5by8411cg5lk5fvfylvl0i
        Console.WriteLine(ots.GetSecretLink(generated)); // https://onetimesecret.com/secret/ikzx3m77j5by8411cg5lk5fvfylvl0i


        var shared = ots.ShareSecret("Hello, OTS!");


        Console.WriteLine(shared.MetadataKey); // kd6rgsucl98qbgu9eavjq4k5sdxsom0
        Console.WriteLine(ots.GetMetadataLink(shared)); // https://onetimesecret.com/private/kd6rgsucl98qbgu9eavjq4k5sdxsom0
    }
}
```

***

### Go

[GitHub page - go-onetimesecret](https://github.com/corbaltcode/go-onetimesecret) by [Corbalt](https://github.com/corbaltcode/) — community-maintained (last commit 2026-05, updated for the `us.onetimesecret.com` host). Includes a CLI.

#### go-onetimesecret example

```go
import ots "github.com/corbaltcode/go-onetimesecret"


client := ots.Client{
  Username: "user@example.com",
  Key: "my api key",
}


metadata, err := client.Put("the launch codes", "passphrase", 0, "")
if err != nil {
  // handle error
}


secret, err := client.Get(metadata.SecretKey, "passphrase")
if err != nil {
  // handle error
}


// prints "the launch codes"
print(secret)
```

#### go-onetimesecret CLI example

```bash
$ go install github.com/corbaltcode/go-onetimesecret/cmd/ots@latest


$ ots put 'what is essential is invisible to the eye'
hdjk6p0ozf61o7n6pbaxy4in8zuq7sm ifipvdpeo8oy6r8ryjbu8y7rhm9kty9


$ ots get hdjk6p0ozf61o7n6pbaxy4in8zuq7sm
what is essential is invisible to the eye


$ ots gen
rVjbS$twCJkS 4nwhy7v4fnabayqc5auv4ogh0nfr20 flsdlaun6hwczqu9utmc0vts5xj9xu1


$ ots burn flsdlaun6hwczqu9utmc0vts5xj9xu1
flsdlaun6hwczqu9utmc0vts5xj9xu1
```

***

### Go (lib)

[GitHub page - otsgo](https://github.com/emdneto/otsgo) by [Emídio Neto](https://github.com/emdneto) — community-maintained (last release v1.1.0, 2024-03). Regional-domain support not documented.

#### otsgo example

```go
// Build a new client
client := ots.NewClient(
      WithUsername("otsuser@domain.com"),
      WithApiKey("xxxxxxxx"),
)


// Send a request with context
ctx := context.Background()
response, err := client.GetStatus(ctx)
if err != nil {
      panic(err)
}


fmt.Println(response.Status)
```

***

### PowerShell

[GitHub page - OneTimeSecret](https://github.com/chelnak/OneTimeSecret) by [Craig Gumbley](https://www.helloitscraig.co.uk) — **unmaintained** (last release 2021-06). Supports a custom `-BaseUrl`, so it can point at a region or self-hosted instance, but it predates API v2.

The example below is for Craig Gumbley’s community module, whose name is also used by the official SDK. For new PowerShell integrations, choose the official SDK from the [PowerShell SDK section above](#powershell-sdk).

#### OneTimeSecret PowerShell example

```powershell
# Install from the PowerShell gallery
Install-Module -Name OneTimeSecret -Scope CurrentUser


# Set connection information
Set-OTSAuthorizationToken -Username user@mail.com -APIKey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


# Generate a new shared secret
New-OTSSharedSecret -Secret "Very Secret" -Passphrase 1234 -Recipient user@mail.com


# Retrieve a secret
Get-OTSSecret -SecretKey qqevnp70b4uoiax4knzhwlhros6ne7x -Passphrase 1234


# View all functions that are available
Get-Command -Module OneTimeSecret | Select Name
```

***

### Bash

[GitHub page - onetimesecret-bash](https://github.com/eengstrom/onetimesecret-bash) by [Eric Engstrom](https://eengstrom.github.io/) — **unmaintained** (last commit 2020-05). Supports a custom host via `ots_set_host`, but predates API v2 and regional domains.

#### onetimesecret-bash scripting example

```bash
# source for use anonymously (secrets created anonymously)
source ots.bash


# or, source with specific auth credentials
APIUSER="USERNAME"
APIKEY="APIKEY"
source ots.bash -u $APIUSER -k $APIKEY


# check status of server
ots_status


# create a secret and get back the URL
URL=$(echo "secret" | ots_share)


# share a multi line secret via HEREDOC.
URL=$(ots_share <<-EOF
      This is a Secret
      ... on multiple lines
EOF
)


# pass options to share or generate.
URL=$(ots_share ttl=600 \
                  passphrase="shared-secret" \
                  recipient="someone@somewhere.com" <<< "SECRET")


# fetch the secret data
DATA="$(ots_retrieve "$URL")"


# share/generate a new secret, and get back the private metadata key
KEY=$(ots_metashare <<< "SECRET")
KEY=$(ots_metagenerate)


# get a list of private metadata keys recently created.
# note that this requires valid authentication credentials
RECENT=( $(ots_recent) )


# check on the current state of a secret, given the private key
ots_state $KEY


# burn a secret, given the private key
ots_burn $KEY
```

#### onetimesecret-bash CLI example

```bash
# Share a secret (from stdin)
./ots share
SECRET
^D


# Share a secret (via HEREDOC)
./ots share <<-EOF
      This is a multi-line secret via HEREDOC.
      Something else goes here.
EOF


# Get/Retrieve a secret:
./ots get <key|url>
./ots retrieve <key|url>


# Burn a secret, given its private metadata key:
./ots burn <key>
```