---
title: "Auth"
description: "<p>API for creation or storage of auth tokens.  Most of these</p><p>tokens are created from the Integrations/Imports setup for Lytics integrations.</p><p>Additionally, api tokens can be created/managed from this endpoint.</p><p>The oauth, config information are write only attributes that</p><p>cannot be subsequently read from the api, and is stored encrypted.</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/v1/auth"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-05"
---

# Auth

API for creation or storage of auth tokens. Most of these

tokens are created from the Integrations/Imports setup for Lytics integrations.

Additionally, api tokens can be created/managed from this endpoint.

The oauth, config information are write only attributes that

cannot be subsequently read from the api, and is stored encrypted.

## Retrieve a Single Auth

### Retrieve a Single Auth

**GET** `/api/auth/{id}`

This API is fairly special, as only the public portions of the auth model are

returned, not all fields \*\*config\*\*, \*\*oauth2token\*\*, and \*\*oathtoken\*\* fields are

never exposed.

#### URL Parameters

- **id** (required)
  ID of the Gist in the form of a hash.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **access_token** (optional)
  Lytics API access token.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": "success",
  "data": {
    "account_id": "4f7b525bdba058fc096757a6",
    "id": "1b53b88a06b418b07d601b6f57b8eb40",
    "provider_id": "26cae7718c32180a7a0f8e19d6d40a59",
    "provider_name": "Facebook",
    "user_id": "4222fd7c8db7ebcb042e0547e3b4e128"
  }
}
```

## Create Auth

### Create Auth

**POST** `/api/auth/{id}`

Create an auth, would normally never be used via the api, the web admin

Integrations section manages these.

#### URL Parameters

- **id** (required)
  ID of the Gist in the form of a hash.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **access_token** (optional)
  Lytics API access token.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": "success",
  "data": {
    "account_id": "4f7b525bdba058fc096757a6",
    "id": "1b53b88a06b418b07d601b6f57b8eb40",
    "provider_id": "26cae7718c32180a7a0f8e19d6d40a59",
    "provider_name": "Facebook",
    "user_id": "4222fd7c8db7ebcb042e0547e3b4e128"
  }
}
```

## Update Auth

### Update Auth

**PUT** `/api/auth/{id}`

#### URL Parameters

- **id** (required)
  ID of the Gist in the form of a hash.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **access_token** (optional)
  Lytics API access token.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": "success",
  "data": {
    "account_id": "4f7b525bdba058fc096757a6",
    "id": "1b53b88a06b418b07d601b6f57b8eb40",
    "provider_id": "26cae7718c32180a7a0f8e19d6d40a59",
    "provider_name": "Facebook",
    "user_id": "4222fd7c8db7ebcb042e0547e3b4e128"
  }
}
```

## Remove an Auth

### Remove an Auth

**DELETE** `/api/auth/{id}`

Deleting an auth is a very special operation. If any work is running (imports, exports),

it will remove the auth from those works and stop them.

#### URL Parameters

- **id** (required)
  ID of the Gist in the form of a hash.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **access_token** (optional)
  Lytics API access token.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
No Content
```

## Auth Create Token

### Auth Create Token

**POST** `/api/auth/createtoken`

Create Lytics api tokens.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": "success",
  "data": {
    "account_id": "4f7b525bdba058fc096757a6",
    "id": "1b53b88a06b418b07d601b6f57b8eb40",
    "provider_id": "26cae7718c32180a7a0f8e19d6d40a59",
    "name": "my-token-for-service-x",
    "provider_name": "Lytics",
    "config": [
      {
        "api_key": "api_value"
      }
    ]
  }
}
```