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

# Quickstart

# Getting Started

This guide explains how to use Outerport's Python SDK to make API calls.

## Installation

You can install the Outerport Python SDK from PyPI (Python Package Index).

<CodeGroup>
  ```bash pip
  pip install outerport
  ```

  ```bash uv
  uv add outerport
  ```
</CodeGroup>

## Initializing the Client

To use the Outerport Python SDK, you need to first get your Outerport API key.

<Warning>
  Currently, the Outerport API is invite only. To get access, please contact us at [support@outerport.com](mailto:support@outerport.com).
</Warning>

Once you have your API key, you can initialize the client as follows:

```python
from outerport import OuterportClient

client = OuterportClient(api_key="your_api_key")
```

### Using a Self-Hosted Outerport API service

If you are hosting your own Outerport API, you can set the `base_url` to the URL of your hosted API.

```python
client = OuterportClient(
    api_key="your_api_key",
    base_url="http://localhost:8080"
)
```

## Basic Usage

### Uploading a Document

You can upload a document using the `client.documents.create` method.

```python
with open("document.pdf", "rb") as f:
    doc = client.documents.create(file=f)
```

The `client.documents.create` method returns a `Document` object.

<Note>
  The Outerport Python SDK returns an object when creating a "resource". The returned object is connected to the client, so you can call the `reload()` method to get the latest data or the `delete()` method to delete it.
</Note>

### Asking a Question

You can ask a question about a document using the `client.questions.create` method.

```python
question = client.questions.create(
    document_ids=[doc.id],
    question="What is our password policy?"
)
```

The `client.questions.create` method returns a `Question` object.

<CodeGroup>
  ```python Print Final Answer
  print(question.final_answer)
  ```

  ```json Final Answer
  "The password policy states that passwords must be at least 8 characters long."
  ```
</CodeGroup>

In addition to the `question.final_answer`, the `question.plan` and `question.evidences` contain the process of answering the question. For example, `question.evidences` returns the following result:

<CodeGroup>
  ```python Print Evidences
  print(question.evidences)
  ```

  ```json Evidences
  [
      {
          "id": 1,
          "evidence": "Password Policy: passwords must be at least 8 characters long.",
          "reasoning": "This quote is about the password policy.",
          "document_id": 1,
          "sequence_number": 1
      }
  ]
  ```
</CodeGroup>

### Searching for Relevant Documents

You can search for relevant documents using the `client.documents.search` method.

```python
documents = client.documents.search(query="Tell me about the password policy")
```

The `client.documents.search` method returns a list of `Document` objects.

You can also specify a tag or folder to search for.

```python
documents = client.documents.search(
    query="Explain the password policy", 
    tag="security"
)
```
