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

# الحساب

> سجّل الدخول، سجّل الخروج، وتفقّد سياق حساب CLI النشط

تستخدم واجهة سطر الأوامر (CLI) مفتاح API للأوامر التي تتطلب المصادقة. يمكنك حفظه مرة واحدة عبر `youka login`، أو توفيره من خلال `YOUKA_API_KEY` في CI وغيرها من البيئات غير التفاعلية.

يتحقق `youka login` من المفتاح عبر API قبل حفظه، ثم يخزّن مؤقتًا بريد الحساب الإلكتروني الناتج في `~/.youka/config.json` لأغراض التشخيص.

## `login`

احفظ مفتاح API في `~/.youka/config.json`.

```bash theme={null}
youka login [token]
```

<ParamField path="token" type="string">
  مفتاح API الذي تم نسخه من لوحة تحكم Youka. إذا تم حذفه، تطلب واجهة CLI إدخاله
  في طرفية تفاعلية.
</ParamField>

### أمثلة

<CodeGroup>
  ```bash token theme={null}
  youka login yk_live_abcd1234
  ```

  ```bash with-api theme={null}
  youka login yk_live_abcd1234 --api https://staging-api.youka.test --json
  ```
</CodeGroup>

<Tip>في CI، يُفضّل استخدام `YOUKA_API_KEY` بدلًا من كتابة ملف إعدادات.</Tip>

## `logout`

أزل مفتاح API المحفوظ من `~/.youka/config.json`.

```bash theme={null}
youka logout
youka logout --json
```

## `whoami`

افحص مصدر المفتاح الناتج، وعنوان URL الخاص بـ API، وهوية الحساب.

```bash theme={null}
youka whoami
youka whoami --json
```

مثال على الاستجابة:

```json theme={null}
{
  "ok": true,
  "data": {
    "authenticated": true,
    "tokenPresent": true,
    "authStatus": "verified",
    "identitySource": "live",
    "keySource": "config",
    "apiUrl": "https://api.youka.io/ar/api/v1",
    "apiUrlSource": "default",
    "email": "user@example.com",
    "userId": "user_123",
    "apiKeyId": "key_123",
    "org": null,
    "configPath": "/Users/you/.youka/config.json",
    "apiKeyPreview": "yk_l...1234"
  }
}
```

### ترتيب الاستنتاج

| الحقل                  | الترتيب                                                                   |
| ---------------------- | ------------------------------------------------------------------------- |
| مفتاح API              | `YOUKA_API_KEY`, ثم `~/.youka/config.json`                                |
| عنوان URL الخاص بـ API | `--api`, ثم `YOUKA_API_BASE_URL`, ثم `~/.youka/config.json`, ثم الافتراضي |

عند تفعيل مفتاح إعدادات محفوظ، يتحقق `whoami` من الهوية عبر API ويعود إلى بريد الحساب الإلكتروني المخزّن مؤقتًا فقط إذا كانت عملية البحث المباشر غير متاحة. ولا يستخدم الهوية المخزّنة في الإعدادات لمفاتيح `YOUKA_API_KEY`.

## ما التالي

* [الخيارات العامة](/ar/cli/global-options) - أعلام مشتركة لكل أمر
* [المشاريع](/ar/cli/projects) - إنشاء ومعالجة مشاريع الكاريوكي
