> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/hi/apis/api-authentication.md).

# API प्रमाणीकरण

Unitlab HTTP API में प्रमाणीकरण: हर अनुरोध के साथ Authorization हेडर में वर्कस्पेस API कुंजी भेजें और 401 व 403 एरर को सही तरह संभालें।

कुंजी को `Authorization` हेडर में `Api-Key` स्कीम के साथ भेजें:

```bash
curl -s https://api.unitlab.ai/api/sdk/projects/ \
  -H "Authorization: Api-Key $UNITLAB_API_KEY"
```

```python
import os, httpx

api = httpx.Client(
    base_url="https://api.unitlab.ai/api/sdk/",
    headers={"Authorization": f"Api-Key {os.environ['UNITLAB_API_KEY']}"},
    timeout=60,
)
print(api.get("projects/").json())
```

वर्कस्पेस कुंजी से तय होता है। कोई workspace पैरामीटर नहीं है।

कुंजियाँ **Settings** > **API keys** में बनाएँ और प्रबंधित करें। देखें [प्रमाणीकरण और API कुंजियाँ](https://docs.unitlab.ai/api-sdk-cli/hi/get-started/authentication-and-api-keys.md)।

## रिस्पॉन्स <a href="#responses" id="responses"></a>

| Status | बॉडी                                                          | अर्थ                                                                                         |
| ------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| 401    | `{"detail": "Authentication credentials were not provided."}` | कुंजी नहीं दी गई, गलत कुंजी, या ऐसी कुंजी जो बंद, डिलीट या expire हो चुकी है                 |
| 403    | `{"detail": "...", "code": "permission_denied"}`              | कुंजी में इस रूट की अनुमति नहीं है, या कार्रवाई के लिए किसी ख़ास व्यक्ति की बनाई कुंजी चाहिए |
| 403    | `{"detail": "...", "code": "workspace_read_only"}`            | वर्कस्पेस अभी बदला नहीं जा सकता। Read अनुरोध अब भी चलते हैं।                                 |
| 403    | कोई और `code`                                                 | प्लान या कोटा इस कार्रवाई की अनुमति नहीं देता                                                |

## साइन किए गए लिंक <a href="#signed-links" id="signed-links"></a>

कुछ रिस्पॉन्स में मीडिया या डाउनलोड के साइन किए गए लिंक होते हैं, जैसे `source_url`, `file` और `upload_url`। इन्हें `Authorization` हेडर के **बिना** माँगें। ये expire हो जाते हैं; इन्हें सहेजने की बजाय API से नया लिंक माँगें।

## संबंधित <a href="#related" id="related"></a>

[API परिचय](https://docs.unitlab.ai/api-sdk-cli/hi/apis/api-overview.md) · [एरर, रेट लिमिट और pagination](https://docs.unitlab.ai/api-sdk-cli/hi/apis/errors-rate-limits-and-pagination.md)
