Link Search Menu Expand Document

Take Basis Theory For A Spin

Basis Theory is built to encrypt, decrypt, tokenize, and delegate any payload of data that can be serialized. To show the flexibility of our tokenization platform, the following guide will show you how you can tokenize any payload in an application.

Table of contents

  1. Register for Basis Theory
  2. Create an Application
  3. Download the Sample Application
  4. Go to Directory
  5. Run the Application
  6. Insert Application API Key
  7. Encrypt your data
  8. Decide who encrypts
  9. Retrieve your token
  10. Decrypt your token

Get Started

We are pleased to offer you this 10-step guide and sample application to demonstrate how to tokenize data using Basis Theory. This is an excellent way to quickly get started testing Basis Theory end to end. If you’d rather dive right into the API, run on over to the sandbox.

If you prefer to test out our API directly in Postman, you can quickly get started using our official library:

Run in Postman

Register for Basis Theory

Sign up and validate your e-mail. You can sign up for a free Basis Theory account here.

Create an Application

Generate your first API key. To generate your first API key head to the portal and click “Create New Application” in the Applications tab. Select the following scopes when creating your API Key

  • token:decrypt
  • token:read
  • token:create

After your API key is generated, copy your API key. You’ll need it for a future step.

Download the Sample Application

Download the sample Basis Theory application. You can download it from GitHub or clone the repository

git clone https://github.com/Basis-Theory/basistheory-sample-app-dotnet.git

Go to Directory

Go to the directory where you downloaded the app. If you used git this should be

cd basistheory-sample-app-dotnet

Run the Application

Run the application by using the following command

make token

Insert Application API Key

When the app starts add the API key you generated the Create an Application step.

Screenshot of sample app api key

Encrypt your data

Encrypt your first payload. The app gives you the ability to encrypt text or a file. A basic account is limited to a 1mb payload, so if you do select a file to encrypt make sure it’s under 1mb. After you encrypt and submit the ciphertext via the API, you’ll retrieve a token.

Screenshot of tokenizing data

Decide who encrypts

Decide if you want to encrypt your data using a key pair only you have on your computer, or encrypt using a key pair hosted at Basis Theory. If you use a key pair that is only on your machine, all encryption and decryption will be done on your computer. Basis Theory will not be able to decrypt your data.

Screenshot of how to encrypt

Retrieve your token

Now that you’ve created your first token and encrypted the data behind it, you can use the API to retrieve the token and the encrypted payload.

Screenshot of retrieving a token

Decrypt your token

Great! You’ve retrieved the token and the encrypted data along with it. Now you can decrypt it to see the original payload.

Screenshot of decrypting a token

You did it!

We suggest celebrating this new-found knowledge by going back and repeating steps 7-10 with different types of data and encryption methods. If you’re not sure if you want to do that, take a quick 5 second smile.