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

# Authentication

> Learn how to authenticate with the Osmosis API

<Note>
  All API requests to Osmosis require authentication. Your API key serves as both your authentication token and tenant identifier.
</Note>

## Getting an API Key

<Steps>
  <Step title="Request Access">
    Contact us at [founders@gulp.ai](mailto:founders@gulp.ai) to request API access.
  </Step>

  <Step title="Receive Credentials">
    Once approved, you'll receive your unique API key via email.
  </Step>

  <Step title="Test Access">
    Verify your API key works by making a test call to any endpoint.
  </Step>
</Steps>

## Using Your API Key

<CodeGroup>
  <Code title="HTTP Headers">
    ```bash
    'x-api-key: your_api_key_here'
    'Content-Type: application/json'
    ```
  </Code>
</CodeGroup>

Include your API key in all requests to the Osmosis API using the `x-api-key` header:

<CodeGroup>
  <Code title="cURL">
    ```bash
    curl --location 'https://osmosis.gulp.dev/enhance_task' \
    --header 'x-api-key: your_api_key_here' \
    --header 'Content-Type: application/json' \
    --data '{
      "tenant_id": "your_api_key_here",
      "input_text": "Your query here"
    }'
    ```
  </Code>
</CodeGroup>

## Tenant ID

<Warning>
  The `tenant_id` field in request bodies corresponds to a unique recommendation collection, enabling sub-tenancy isolation for different agentic workflows. This ensures proper data isolation and security between different agent instances and use cases.
</Warning>

Example request body structure:

<CodeGroup>
  ```bash cURL
  # Basic authentication example
  curl -X POST https://osmosis.gulp.dev/any_endpoint \
    -H "Content-Type: application/json" \
    -H "x-api-key: your-api-key" \
    -d '{
      "tenant_id": "your-api-key"
    }'
  ```

  ```typescript TypeScript
  // Basic authentication example
  import axios from 'axios';

  async function makeAuthenticatedRequest() {
    const apiKey = process.env.OSMOSIS_API_KEY;
    
    const response = await axios.post('https://osmosis.gulp.dev/any_endpoint', {
      tenant_id: apiKey
    }, {
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': apiKey
      }
    });
    
    return response.data;
  }
  ```

  ```python Python
  # Basic authentication example
  import os
  import requests

  def make_authenticated_request():
      api_key = os.getenv('OSMOSIS_API_KEY')
      
      response = requests.post(
          "https://osmosis.gulp.dev/any_endpoint",
          json={"tenant_id": api_key},
          headers={
              "Content-Type": "application/json",
              "x-api-key": api_key
          }
      )
      
      return response.json()
  ```

  ```go Go
  // Basic authentication example
  package main

  import (
      "bytes"
      "encoding/json"
      "net/http"
      "os"
  )

  func makeAuthenticatedRequest() (*http.Response, error) {
      apiKey := os.Getenv("OSMOSIS_API_KEY")
      
      payload := map[string]string{
          "tenant_id": apiKey,
      }

      jsonData, err := json.Marshal(payload)
      if err != nil {
          return nil, err
      }

      req, err := http.NewRequest("POST", "https://osmosis.gulp.dev/any_endpoint", bytes.NewBuffer(jsonData))
      if err != nil {
          return nil, err
      }

      req.Header.Set("Content-Type", "application/json")
      req.Header.Set("x-api-key", apiKey)

      client := &http.Client{}
      return client.Do(req)
  }
  ```
</CodeGroup>

## Error Handling

<ResponseField name="401 Unauthorized" type="object">
  ```json
  {
    "error": "invalid_api_key",
    "message": "The provided API key is invalid or has been revoked"
  }
  ```
</ResponseField>

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="book" href="/api-reference/overview">
    Explore the complete API documentation
  </Card>

  <Card title="Support" icon="headset" href="mailto:founders@gulp.ai">
    Contact us if you need help with authentication
  </Card>
</CardGroup>
