> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leen.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> An introduction to building with Leen

# Getting started with Leen

Let's introduce you to a few concepts to get you started with Leen.

Leen provides a common data model to represent data from various security products (connections), we provide data models on a per-category basis with support for:

1. Vulnerability Management Systems ([VMS](/api-reference/vms))
2. Application Security ([AppSec](/api-reference/appsec))
3. Endpoint Detection and Response ([EDR](/api-reference/edr))
4. Cloud Security Posture Management ([CSPM](/api-reference/cspm))
5. Identity Provider ([IDP](/api-reference/idp))
6. Vulnerability Findings ([Vulnerability Findings](/api-reference-v2))
7. Governance, Risk and Compliance ([GRC](/api-reference/grc))
8. IT Service Management ([ITSM](/api-reference/itsm))
9. Third Party Risk Management ([TPRM](/api-reference/tprm))

Leen also extracts and tracks certain entities from connections to better organize and give a more holistic view of the data. For example, we extract the *Device* data from a VMS connection and track it separately.
Check out our [Entities](/api-reference/entities) endpoints for detailed information.

#### Organizations and Connections

For Leen to correctly connect to an integration source on behalf of your customer we need to store some information about your customer's organization. We do this by representing your customer as an **organization**. Before adding a connection, to pull data from, we need to first make sure an organization is added to Leen.

**Connections** represent an integration from one of the security products we support. A `connection` must belong to an `organization` that is owned by you. When you add a new connection to an `organization` you'll be given a `connection-id` that you will use to pull data. Currently, all requests to Leen's API require a `connection-id` to be included in your authentication headers since all data is **scoped** to a given connection.

# Connecting to Leen

First, you'll need an **API Key** to get started. You should have received one in your email when you signed up. If you haven't, please contact us at [contact@leen.dev](mailto:contact@leen.dev).

<Tip>More details on our authentication can be found [here](/api-reference/authentication)</Tip>

<Steps>
  <Step title="Create an Organization">
    To provision a new organization, you'll need to make a `POST` request to the `/provisioning/organizations`
    endpoint. This will create a new organization and return an `organization-id` that you will use to add connections.

    <Accordion title="Example POST body">
      ```json theme={null}
      {
      "identifier": "<string>", // the identifier in your application that is used to for your customer
      "name": "<string>" // a friendly name to identify your customer
      }
      ```
    </Accordion>

    <Accordion title="Example Response">
      The response will look like this:

      ```json theme={null}
      {
        "id": "<UUID>", // the organization ID
        "identifier": "<string>", // the identifier in your application that is used to for your customer
        "name": "<string>" // a friendly name to identify your customer
      }
      ```
    </Accordion>

    You'll use the organization's ID to create a new connection in the next step. We recommend storing this ID
    alongside your customer's information in your application.
    You can also easily find an organization’s ID by identifier or name by making a GET call and doing a 2-hop request.

    See the [API Reference page](/api-reference/provisioning/add-organization) for more details.
  </Step>

  <Step title="Create a Connection">
    Now that we have created an organization we will create a connection to pull data from. To do this, we'll make a `POST`
    request to the `/provisioning/organizations/{organization_id}/connections` endpoint. This will create a new connection
    and return a `connection-id` that you will use to pull data.

    You will need to specify the `vendor` and `credentials` for the connection. The `vendor` is the name of the
    product that Leen is connecting to and the credentials object will be specific to the vendor. More information
    can be found on the [API Reference page.](/api-reference/provisioning/add-new-connection)

    <Accordion title="Example POST body">
      ```json theme={null}
      {
        "credentials": {
          "client_key": "<string>",
          "secret_key": "<string>"
        },
        "vendor": "TENABLE"
      }
      ```
    </Accordion>

    <Accordion title="Example Response">
      ```json theme={null}
       {
           "organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
           "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
           "vendor": "<string>"
       }
      ```
    </Accordion>
  </Step>

  <Step title="Pull Data">
    Now that we have an organization and connection setup, we can start pulling data. To do this, we'll make a `GET`
    to any relevant data endpoints with your `API key` and `Connection-ID` in the headers. For example, to pull Vulnerability Management data you'd send this request.

    <Accordion title="Example Request">
      ```bash theme={null}
        curl --request GET \
            --url https://api.leen.dev/v1/vms/vulnerabilities \
            --header 'X-API-KEY: <x-api-key>' \
            --header 'X-CONNECTION-ID: <x-connection-id>' \
      ```
    </Accordion>
  </Step>
</Steps>
