# Structurely Direct v2

## Overview

The Structurely API allows integrators to provide automation for their accounts. It offers various functionalities to streamline lead management, messaging, lead qualification conversations, and retrieval of metadata.

The Structurely API simplifies the integration process and removes the necessity to track additional fields in your system. It is specifically designed to utilize **your system's IDs** as internal keys, enabling you to seamlessly use IDs from your CRM or database as parameters, such as externalLeadId, and externalMessageId.

By utilizing this API, integrators can streamline their workflows, activate enhanced AI qualification conversations, and gain valuable insights into their accounts, leads, and conversations.

### Security

The Structurely API provides secure authentication and authorization mechanisms to ensure controlled access to its endpoints. The authentication system utilizes API tokens to secure interactions with the API.

Types of tokens and keys:

  
- bearer-access-token: Bearer JWT; **valid until deactivated**

**Note:** It is essential to keep your bearer-access-tokens secure and avoid sharing them with unauthorized parties to maintain the integrity and security of your Structurely API integration.

Version: `v3.35.20`

## Scripts

- [GET /api/direct/v2/scripts](/api/direct/v2/scripts/get.md)

### GET /api/direct/v2/scripts

[GET /api/direct/v2/scripts](/api/direct/v2/scripts/get.md)

**Summary:** Retrieve a list of available scripts

**Description:**

This endpoint will return a list of scripts available to your account

#### Responses

- `200`: A script available to your account
  - Schema: `Scripts`
  ```json
  {
    "type": "object",
    "properties": {
      "scripts": {
        "description": "A list of scripts your account can use",
        "example": [
          {
            "name": "buyer",
            "displayName": "Buyer",
            "isCustom": false,
            "isCampaign": false
          }
        ],
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Script"
        }
      }
    }
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X GET 'https://client.structurely.com/api/direct/v2/scripts' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Schemas

### `InternalServerError`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "Internal server error"
    },
    "statusCode": {
      "type": "number",
      "example": 500
    }
  }
}
```

### `InvalidRequest`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "The parameter leadId must be provided"
    },
    "statusCode": {
      "type": "number",
      "example": 400
    }
  }
}
```

### `NotAuthorized`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "Access Token is not authorized"
    },
    "statusCode": {
      "type": "number",
      "example": 401
    }
  }
}
```

### `Script`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name of the script, send this when starting a conversation",
      "example": "buyer"
    },
    "displayName": {
      "type": "string",
      "description": "The value to display users to help them choose a script",
      "example": "Buyer"
    },
    "isCustom": {
      "type": "boolean",
      "description": "Is this script customized to you",
      "example": "false"
    },
    "isCampaign": {
      "type": "boolean",
      "description": "True when this script represents a campaign",
      "example": "false"
    }
  },
  "required": [
    "displayName"
  ]
}
```

### `Scripts`

```json
{
  "type": "object",
  "properties": {
    "scripts": {
      "description": "A list of scripts your account can use",
      "example": [
        {
          "name": "buyer",
          "displayName": "Buyer",
          "isCustom": false,
          "isCampaign": false
        }
      ],
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Script"
      }
    }
  }
}
```

## Security

### `bearer-access-token`

```json
{
  "type": "http",
  "scheme": "bearer",
  "bearerFormat": "JWT"
}
```
