Client Libraries

BETA API - updated 2017-04-27 (Have a question?)


Download onetime-api.php
by Christopher Murtagh (added 2011-12-21)

Usage Example

  $myOnetime = new OneTimeSecret;
  $myResult = $myOnetime->shareSecret('Jazz, jazz and more jazz.', 'thepassword');
  print $myOnetime->getSecretURI($myResult);


Download onetime-api.rb
by Delano Mandelbaum (added 2011-12-21)

Usage Example

require 'onetime/api'
options = {
  :secret => 'Jazz, jazz and more jazz.',
  :recipient => '',
  :ttl => 7200
ret = '/share', options
puts ret['secret_key']


by Vladislav Stepanov (added 2012-06-26)

Usage Example

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'}


Download Net::OneTimeSecret
by Kyle Dawkins (added 2012-01-06)

Usage Example

#!/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 => '',
                   ttl => 7200,
printf( "%s\n", $result->{secret_key} );

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


Download onetime-java
by Marcin Pawlowski (added 2014-05-22)

Usage Example

OneTimeSecret ots = new OneTimeSecretRestImpl(

GenerateResponse generateResponse = ots.generate(
                new GenerateRequest.Builder()

RetrieveResponse retrieveResponse = ots.retrieve(
                new RetrieveRequest.Builder()

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


Download OneTimeSharp
by Vladislav Stepanov (added 2014-05-29)

Usage Example

# 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)); //

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

        Console.WriteLine(shared.MetadataKey); // kd6rgsucl98qbgu9eavjq4k5sdxsom0
        Console.WriteLine(ots.GetMetadataLink(shared)); //


Download onetimesecret
by Corbalt (added 2021-12-10)

Usage Example

import ots ""

client := ots.Client{
  Username: "",
  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"

Usage Example as CLI

$ go install

$ 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


Download OneTimeSecret
by Craig Gumbley (updated 2017-04-28)

Usage Example

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

# Set connection information
Set-OTSAuthorizationToken -Username -APIKey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Generate a new shared secret
New-OTSSharedSecret -Secret "Very Secret" -Passphrase 1234 -Recipient

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

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


Download OneTimeSecret-Go
by Craig Gumbley (updated 2020-08-20)

Usage Example

// Build a new client
client := ots.NewClient(

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



Download OneTimeSecret-bash
by Eric Engstrom (updated 2018-12-19)

Usage Example as Scripting API

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

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

# check status of server

# 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

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

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

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

# get a list of private metadata keys recently created.
# note that this requires valid autnentication credentials
local -a 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

Usage Example as CLI

# Share a secret (from stdin
./ots share

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

# Get/Retrieve a secret:
./ots get 
./ots retrieve 

# Burn a secret:
./ots burn 

# Use --help for complete list of command line actions and known options:
./ots --help

If you implement another language, let us know and we'll add it here!