# Get started with Skyflow

> Make your first API calls to Skyflow.

Managing your data with Skyflow is as simple as making an API call. By the end of this guide, you'll have used the Data API to insert and retrieve sensitive data from a vault.

## Prerequisites

Before you get started,

- Make sure you have a terminal that can run `bash` commands.
- [Sign in](https://docs.skyflow.com/docs/resources/sign-in) to your Skyflow account. If you don't have an account,
  [sign up for a free trial](https://www.skyflow.com/try-skyflow).

The following content uses the [Quickstart vault template](https://docs.skyflow.com/docs/vaults/create-a-vault). Adapt your commands accordingly.

## Get vault information

Every account comes with a Quickstart vault. This vault is pre-configured with two tables: `credit_cards` and `persons`. Before you can insert data into the vault, you'll need to gather some information. Alternatively, you can [create a vault](https://docs.skyflow.com/docs/vaults/create-a-vault) and gather that vault's information instead.

1. In Studio, click **vault menu icon > View vault details**.
2. Note your **Account ID**, **Vault ID**, and **Vault URL** values.
3. Set environment variables for your account, vault, and auth details:

```bash
export ACCOUNT_ID=$ACCOUNT_ID
export VAULT_ID=$VAULT_ID
export VAULT_URL=$VAULT_URL
```

## Authenticate

To authenticate API calls, you need a JWT bearer token or an API key. For a short-lived token, use the following process. To generate tokens from service accounts, see [Authenticate](/docs/fundamentals/api-authentication/).

1. In Studio, click your account icon and choose **Generate API Bearer Token**.
2. Click **Generate Token**. Studio copies the token to your clipboard. The token is valid for 24 hours.
3. Set an environment variable for your token:

```bash
export TOKEN=$TOKEN
```

## Insert data

When you insert a record, you specify the table name in the URL of the request and the record values in the request body. The request body is a JSON object with a `records` array. Each object in the `records` array has a `fields` object with the record values.

The following command inserts a single record into the `credit_cards` table:

```bash
curl -s -X POST "$VAULT_URL/v1/vaults/$VAULT_ID/credit_cards" \
-H "Content-Type: application/json" \
-H "X-SKYFLOW-ACCOUNT-ID: $ACCOUNT_ID" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "records": [
        {
            "fields": {
                "card_number": "7483905725643605",
                "cardholder_name": "Jane Doe",
                "expiry_month": "08",
                "expiry_year": "29"
            }
        }
    ],
    "tokenization": false
}'
```

When you insert a record, Skyflow returns the `skyflow_id` of the record. You can use this ID to retrieve the record later.

```json
{
  "records": [
    {
      "skyflow_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
    }
  ]
}
```

If you set the `tokenization` field to `true`, Skyflow also returns tokens for the inserted record values.

```json
{
  "records": [
    {
      "skyflow_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "tokens": {
        "card_number": "b320c8da-0a6e-4e53-9c4a-13d02f0e9a89",
        "cardholder_name": "3d1b6d0f-7b79-4a8e-8b1c-2b4e5c6d7a8e",
        "expiry_month": "9a4c55a7-65f9-4b56-8f43-1e9d2f0c3b86",
        "expiry_year": "b4e58d6c-3a21-4f91-bdc9-87f2a0e4c1d3"
      }
    }
  ]
}
```

For insert options and behaviors, see [Insert records](https://docs.skyflow.com/docs/vaults/insert-records).

## Get data

You can use a record's `skyflow_id` to return record data or tokens.

The following command returns values for the specified record.

```bash
curl -s -X GET "$VAULT_URL/v1/vaults/$VAULT_ID/credit_cards/$SKYFLOW_ID" \
-H "X-SKYFLOW-ACCOUNT-ID: $ACCOUNT_ID" \
-H "Authorization: Bearer $TOKEN"
```

By default, the response includes data for all columns. Data is redacted according to the vault schema and the access policies assigned to the role making the API call.

```json
{
  "fields": {
    "card_number": "XXXXXXXXXXXX3605",
    "cardholder_name": "*REDACTED*",
    "expiry_month": "12",
    "expiry_year": "29",
    "skyflow_id": "e54ac2c6-83ba-4839-8668-e69d66172fa2"
  }
}
```

To return tokens instead of data, add the `tokenization` URL parameter and set it to `true`.

```bash
curl -s -X GET "$VAULT_URL/v1/vaults/$VAULT_ID/credit_cards/$SKYFLOW_ID?tokenization=true" \
-H "X-SKYFLOW-ACCOUNT-ID: $ACCOUNT_ID" \
-H "Authorization: Bearer $TOKEN"
```

The response includes tokens for all columns that have been tokenized.

```json
{
  "fields": {
    "card_number": "5099-5623-3881-2592",
    "cardholder_name": "c46288f6-00f1-4721-8bc4-6f6f2dd4e31e",
    "expiry_month": "2d5f346d-92a7-4a34-9323-7f78e397bc8b",
    "expiry_year": "c2db130e-fac8-4864-806a-6ab03d1be58b"
  }
}
```

For retrieval options and behaviors, see [Get Record by ID](/api/data/records/get-record-by-id/).

## Next steps

Now that you can insert and get records, you're ready to start exploring more of what Skyflow has to offer.

#### [Explore Skyflow](https://docs.skyflow.com/explore-skyflow)

See what Skyflow can do with Studio and the APIs..

#### [Access controls](https://docs.skyflow.com/data-governance-overview)

Control who can access data and what they can do with it..

#### [Tokenization](/docs/tokenization/)

Swap sensitive data for non-sensitive tokens..

#### [Data API](https://docs.skyflow.com/record)

Programmatically store and manage your sensitive data..