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

# प्रोग्रामैटिक लॉगिन API: हेडलेस प्रमाणीकरण token

> Didit का POST /programmatic/login/ हेडलेस प्रमाणीकरण के लिए। सीधे एक्सेस token लौटाता है, 2FA नहीं। एजेंट-नेटिव, MCP-ready, प्रति उपयोग मूल्य निर्धारण।



प्रोग्रामैटिक लॉगिन प्रॉम्प्ट
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\`Exchange a verified Didit account's email + password for a fresh JWT access token (headless, no browser).

Endpoint:
POST https://apx.didit.me/auth/v2/programmatic/login/

Authentication:
None. Email + password is the credential.

Request body:
\- email (string, required) — Same email used at /programmatic/register/.
\- password (string, required) — Plain password (HTTPS only).

Account requirements:
The account must have a verified email and password. Accounts created through POST /programmatic/register/ work immediately after email verification. Console-created email/password accounts can also use this endpoint. OAuth-only console accounts must set a password first.

curl example:
curl -X POST https://apx.didit.me/auth/v2/programmatic/login/ \
-H "Content-Type: application/json" \
-d '{
"email": "you@yourdomain.com",
"password": "MyStr0ng!Pass"
}'

Response (200 OK):
\- access_token (string) — RS256 JWT. Pass as "Authorization: Bearer <access_token>" on every Account Management endpoint at apx.didit.me/auth/v2. DO NOT use against verification.didit.me — that host uses x-api-key.
\- refresh_token (string) — RS256 JWT for refresh flows.
\- expires_in (integer) — Default 86400 (24 hours).

Token shape:
\- 24-hour default lifetime.
\- RS256-signed.
\- No browser session is required.

Brute-force protection:
\- Progressive account lockout per email: 5 consecutive failures = 15 min lockout, 10 = 1 hour, 20 = 24 hours.
\- Per-IP rate limit: 20 attempts/minute and 100 attempts/hour.

Failure modes:
\- 400 — { "email": ["..."] } / { "password": ["..."] } field-level errors.
\- 401 — { "detail": "Invalid email or password." }
\- 403 — { "detail": "..." } when SSO policy blocks password login for the account.
\- 429 — { "detail": "Too many login attempts.", "wait": <seconds> } on lockout or per-IP limit. Honour the wait value before retrying.

Recovering your api_key:
After a successful login, call GET /organizations/me/ to enumerate organizations and applications, then GET /organizations/me/{org_id}/applications/{app_id}/ to read the api_key — see /auth-api/get-credentials.

Where to use access_token vs api_key:
\- access_token (Bearer) → https://apx.didit.me/auth/v2/... (org / app management).
\- api_key (x-api-key) → https://verification.didit.me/v3/... (sessions, workflows, billing).

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.`

\</pre>



      
      

यहाँ पेस्ट करें



## OpenAPI

````yaml hi/openapi-auth.json POST /programmatic/login/
openapi: 3.0.0
info:
  version: 1.0.0
  title: Didit Auth API
  description: >-
    डेवलपर्स और AI एजेंट्स के लिए प्रोग्रामेटिक रजिस्ट्रेशन और प्रमाणीकरण API। 2
    API कॉल्स में रजिस्टर करें -- किसी ब्राउज़र की आवश्यकता नहीं। सबसे अधिक
    एजेंट-अनुकूल पहचान सत्यापन प्लेटफ़ॉर्म।


    ## बेस URL


    इस विनिर्देश के सभी endpoints `https://apx.didit.me/auth/v2` पर होस्ट किए गए
    हैं। यह सत्यापन API (`https://verification.didit.me/v3`) से एक अलग होस्ट है।
    इनका अंतर स्पष्ट रखें: यह ऑथ होस्ट आपके **JWT access tokens** जारी करता है
    और आपको अपने **संगठनों** और **एप्लिकेशन्स** को सूचीबद्ध और प्रबंधित करने की
    अनुमति देता है। सत्यापन होस्ट वह जगह है जहां आप इस API द्वारा लौटाए गए
    **`api_key`** के साथ प्रमाणित होकर सत्रों, वर्कफ़्लो, AML आदि को कॉल करते
    हैं।


    ## ऑथ फ़्लो कैसे काम करता है


    1. `POST /programmatic/register/` — ईमेल + पासवर्ड सबमिट करें।

    2. ईमेल द्वारा 6-वर्णों का अल्फ़ान्यूमेरिक कोड प्राप्त करें।

    3. `POST /programmatic/verify-email/` — कोड सबमिट करें। आपको एक JWT
    `access_token`, एक `refresh_token`, एक संगठन और `client_id` + `api_key` के
    साथ एक डिफ़ॉल्ट एप्लिकेशन वापस मिलता है।

    4. `api_key` को सहेजें। `https://verification.didit.me/v3/...` पर प्रत्येक
    कॉल के लिए इसे `x-api-key` के रूप में उपयोग करें।

    5. भविष्य में किसी भी मशीन से, `POST /programmatic/login/` आपके ईमेल +
    पासवर्ड के बदले एक नया JWT प्राप्त करता है, फिर क्रेडेंशियल्स को रिकवर या
    रोटेट करने के लिए `GET /organizations/me/` और एप्लिकेशन endpoints को कॉल
    करें।


    JWT केवल इस विनिर्देश में **Account Management** endpoints के लिए आवश्यक है;
    सत्यापन API ट्रैफ़िक लंबी अवधि वाले `api_key` का उपयोग करता है, न कि JWT का।


    ## कन्वेंशन


    - सभी अनुरोध और रिस्पॉन्स बॉडी JSON (`Content-Type: application/json`) हैं।

    - **`POST /programmatic/register/` का परीक्षण करते समय वास्तविक, डिलीवर होने
    योग्य ईमेल पते का उपयोग करें।** endpoint सत्यापन कोड को सिंक्रोनस रूप से
    भेजता है, इसलिए आरक्षित परीक्षण डोमेन (`@example.com`, `@example.org`,
    `@*.test`, `@*.example`, `@*.invalid`) पर पतों को मेल डिलीवरी द्वारा
    अस्वीकार कर दिया जाता है और अनुरोध `500` लौटाता है। नमूनों में दिए गए
    `you@yourdomain.com` प्लेसहोल्डर को ऐसे इनबॉक्स से बदलें जिसे आप वास्तव में
    पढ़ सकते हैं।

    - सत्यापन त्रुटियां दो में से किसी एक एन्वेलप के साथ HTTP `400` लौटाती हैं:
    फ़ील्ड-स्तरीय समस्याओं के लिए `{"field": ["message", ...]}` या
    व्यावसायिक-नियम त्रुटियों के लिए `{"detail": "message"}`। कुछ वैलिडेटर
    (रजिस्टर पर पासवर्ड की मजबूती, verify-email पर कोड की समय-सीमा समाप्ति)
    वर्तमान में फ़ील्ड-की वाले फ़ॉर्म के बजाय केवल एक ऐरे `["message"]` के साथ
    रिस्पॉन्स देते हैं -- यह एक ज्ञात सर्वर-साइड विसंगति है, इसलिए क्लाइंट कोड
    को दोनों प्रारूपों को स्वीकार करना चाहिए।

    - प्रमाणीकरण त्रुटियां HTTP `401` (अमान्य bearer token) या `403` (अनुपलब्ध
    bearer token / अपर्याप्त विशेषाधिकार) के साथ `{"detail": "..."}` के रूप में
    वापस आती हैं।

    - रेट लिमिट रिस्पॉन्स में सेकंड में कूलडाउन के साथ एक `wait` फ़ील्ड शामिल
    होता है।
servers:
  - url: https://apx.didit.me/auth/v2
    description: प्रोडक्शन ऑथ सर्वर
security: []
tags:
  - name: Programmatic Auth
    description: >-
      ईमेल-और-पासवर्ड खाता जीवनचक्र: रजिस्टर करें, सत्यापित करें, लॉगिन करें। यह
      JWT `access_token` लौटाता है जिसका उपयोग आप खाता प्रबंधन endpoints के लिए
      करते हैं, साथ ही (सत्यापन पर) आपके पहले एप्लिकेशन की `client_id` और
      `api_key` भी।
  - name: Account Management
    description: >-
      प्रमाणित endpoints (JWT bearer) जो संगठनों को सूचीबद्ध करते हैं और
      एप्लिकेशन बनाते, प्राप्त करते या अपडेट करते हैं। इनका उपयोग उस `api_key`
      को पुनर्प्राप्त या रोटेट करने के लिए करें जिसके साथ आप सत्यापन API कॉल को
      प्रमाणित करते हैं।
paths:
  /programmatic/login/:
    post:
      tags:
        - Programmatic Auth
      summary: प्रोग्रामेटिक लॉगिन
      description: >-
        किसी भी सत्यापित ईमेल/पासवर्ड वाले Didit खाते को प्रमाणित करें और एक
        RS256 JWT युग्म (डिफ़ॉल्ट जीवनकाल 86400s) प्राप्त करें। कंसोल में बनाए
        गए ईमेल/पासवर्ड खाते इस endpoint का उपयोग कर सकते हैं; केवल OAuth वाले
        कंसोल खातों को पहले पासवर्ड सेट करना होगा।
      operationId: programmatic_login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
            examples:
              Default:
                summary: प्रोग्रामेटिक लॉगिन
                value:
                  email: you@yourdomain.com
                  password: MyStr0ng!Pass
      responses:
        '200':
          description: >-
            लॉगिन सफल। एक नया JWT युग्म लौटाता है। `org_id`, `app_id`, और
            `api_key` देखने के लिए `/organizations/me/...` के विरुद्ध
            `Authorization: Bearer <token>` के रूप में `access_token` का उपयोग
            करें। जब खाते में कोई प्रमाणीकरण ऐप या पासकी होती है, तो रिस्पॉन्स
            में टोकन के बजाय `2fa_required: true` और एक `temp_token` शामिल होता
            है।
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
              examples:
                Success:
                  value:
                    access_token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
                    refresh_token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
                    expires_in: 86400
                    message: Login successful
        '400':
          description: >-
            सत्यापन त्रुटि। अनुरोध बॉडी (request body) के साथ फ़ील्ड-स्तरीय
            समस्याएं।
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                MissingFields:
                  summary: खाली बॉडी
                  value:
                    email:
                      - This field is required.
                    password:
                      - This field is required.
                InvalidEmail:
                  summary: गलत स्वरूपित ईमेल
                  value:
                    email:
                      - Enter a valid email address.
        '401':
          description: प्रमाणीकरण अस्वीकृत।
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              examples:
                InvalidCredentials:
                  summary: >-
                    ईमेल + पासवर्ड मेल नहीं खाते (उपयोगकर्ता-एनेमरेशन से बचने के
                    लिए, खाता मौजूद न होने पर भी यही लौटाया जाता है)
                  value:
                    detail: Invalid email or password.
                NotVerified:
                  summary: खाता मौजूद है लेकिन ईमेल अभी तक सत्यापित नहीं है
                  value:
                    detail: Please verify your email address before logging in.
                SSORequired:
                  summary: खाता ऐसे संगठन से संबंधित है जिसे SSO की आवश्यकता होती है
                  value:
                    detail:
                      error: sso_required
                      message: Your organization 'Acme Corp' requires SSO login.
                      organization_name: Acme Corp
                      organization_slug: acme-corp
                      sso_url: /sso/acme-corp
        '403':
          description: >-
            खाता पुनर्प्राप्त कर लिया गया था और लॉग इन करने से पहले एक नई
            साइन-इन विधि सेट करनी होगी। ऐसा करने के लिए एक लिंक खाते के पते पर
            ईमेल किया गया था। जिस खाते का संगठन SSO लागू करता है उसे `error:
            sso_required`, `organization_name`, `organization_slug` और `sso_url`
            के साथ `403` मिलता है।
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecoverySetupRequiredError'
              examples:
                RecoverySetupRequired:
                  summary: पुनर्प्राप्त खाता जिसमें अभी तक कोई साइन-इन विधि नहीं है
                  value:
                    recovery_setup_required: true
                    setup_link_sent: true
                    message: >-
                      You recovered your account. Open the link we emailed you
                      to set up a new sign-in method.
                    code: recovery_setup_required
        '429':
          description: >-
            खाता लॉक है (इस ईमेल पर हाल ही में बहुत अधिक विफलताएं) या IP रेट
            लिमिट लागू है (इस पते से बहुत अधिक प्रयास)। `Retry-After: 5` हेडर के
            साथ भी लौटाया जाता है, जब सेवा एक साथ उतने पासवर्ड या कोड की जांच कर
            रही हो जितने वह कर सकती है; निर्दिष्ट सेकंड के बाद पुनः प्रयास करें।
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
              examples:
                AccountLocked:
                  summary: प्रोग्रेसिव लॉकआउट सक्रिय हुआ
                  value:
                    detail: >-
                      Account temporarily locked due to too many failed login
                      attempts. Please try again later.
                IPRateLimited:
                  summary: इस IP से 20/मिनट या 100/घंटे से अधिक
                  value:
                    detail: >-
                      Too many login attempts from this IP address. Please wait
                      before trying again.
                PasswordChecksBusy:
                  summary: बहुत सारे पासवर्ड सत्यापन प्रगति पर हैं
                  value:
                    detail: >-
                      Too many sign-in attempts are being processed right now.
                      Please try again in a few seconds.
      security:
        - {}
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X POST https://apx.didit.me/auth/v2/programmatic/login/ \
              -H "Content-Type: application/json" \
              -d '{
                "email": "you@yourdomain.com",
                "password": "MyStr0ng!Pass"
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # This call needs no API key.
            client = Didit()

            result = client.account.login(
                email="you@yourdomain.com",
                password="MyStr0ng!Pass",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // This call needs no API key.
            const didit = new Didit();

            const result = await didit.account.login({
              email: "you@yourdomain.com",
              password: "MyStr0ng!Pass",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// This call needs no API key.\nclient := didit.NewClient()\n\nresult, err := client.Account.Login(ctx, didit.LoginRequest{\n\tEmail:    \"you@yourdomain.com\",\n\tPassword: \"MyStr0ng!Pass\",\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: |-
            import me.didit.Didit;
            import me.didit.types.LoginRequest;

            // This call needs no API key.
            Didit client = new Didit();

            var result = client.account().login(LoginRequest.builder()
                    .email("you@yourdomain.com")
                    .password("MyStr0ng!Pass")
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // This call needs no API key.
            $didit = new DiditClient();

            $result = $didit->account->login([
                'email' => 'you@yourdomain.com',
                'password' => 'MyStr0ng!Pass',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # This call needs no API key.
            didit = Didit::Client.new

            result = didit.account.login(
              email: "you@yourdomain.com",
              password: "MyStr0ng!Pass"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: |-
            using System;
            using System.Text.Json;
            using Didit;

            // This call needs no API key.
            using var client = new DiditClient();

            var result = await client.Account.LoginAsync(new LoginRequest
            {
                Email = "you@yourdomain.com",
                Password = "MyStr0ng!Pass",
            });
            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    LoginRequest:
      type: object
      required:
        - email
        - password
      properties:
        email:
          type: string
          format: email
          example: you@yourdomain.com
        password:
          type: string
          example: MyStr0ng!Pass
    LoginResponse:
      type: object
      properties:
        access_token:
          type: string
          description: >-
            RS256-हस्ताक्षरित JWT। खाता प्रबंधन endpoints के लिए `Authorization:
            Bearer <token>` के रूप में उपयोग करें।
        refresh_token:
          type: string
        expires_in:
          type: integer
          description: एक्सेस token का लाइफ़टाइम सेकंड में (डिफ़ॉल्ट 86400)।
          example: 86400
        message:
          type: string
          example: Login successful
    ValidationError:
      description: >-
        सत्यापन त्रुटि बॉडी। अभीष्ट एनवलप फ़ील्ड-स्तरीय त्रुटियों के लिए
        `{field: ["message", ...]}` मैप या व्यावसायिक-नियम त्रुटियों के लिए
        `{detail: "..."}` सिंगल-की एनवलप है। मुट्ठी भर सत्यापनकर्ता (register पर
        पासवर्ड स्ट्रेंथ, verify-email पर कोड वैधता) वर्तमान में एक बेयर ऐरे
        `["message"]` के साथ रिस्पॉन्स देते हैं -- ज्ञात सर्वर-साइड विसंगति।
        नीचे दिया गया स्कीमा उस बेयर-ऐरे शाखा को बनाए रखता है ताकि इस विनिर्देश
        से उत्पन्न क्लाइंट कोड आज के रिस्पॉन्स को डिसेरिएलाइज़ कर सके, लेकिन नए
        क्लाइंट कोड को इसे प्रासंगिक फ़ील्ड-की वाले रूप (`{password: [...]}` या
        `{code: [...]}`) के रूप में मानना चाहिए और सर्वर अनुबंध उस आकार पर
        अभिसरित होगा।
      oneOf:
        - type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            email:
              - Enter a valid email address.
        - type: object
          properties:
            detail:
              type: string
          example:
            detail: An account with this email already exists.
        - type: array
          items:
            type: string
          example:
            - Invalid or expired verification code.
    AuthError:
      type: object
      description: प्रमाणीकरण / प्राधिकरण / नहीं-मिला त्रुटि एनवलप।
      properties:
        detail:
          type: string
          example: Invalid access token
    RecoverySetupRequiredError:
      type: object
      description: >-
        खाता पुनर्प्राप्त कर लिया गया था और अभी तक कोई साइन-इन विधि सेट नहीं की
        गई है। कोई token जारी नहीं किए जाते हैं; नई विधि सेट करने के लिए एक
        वन-टाइम लिंक खाते के पते पर ईमेल किया गया था। इसे खोलें, विधि सेट करें,
        फिर से लॉग इन करें।
      required:
        - recovery_setup_required
        - setup_link_sent
        - message
        - code
      properties:
        recovery_setup_required:
          type: boolean
          example: true
        setup_link_sent:
          type: boolean
          example: true
        message:
          type: string
          example: >-
            You recovered your account. Open the link we emailed you to set up a
            new sign-in method.
        code:
          type: string
          enum:
            - recovery_setup_required
          example: recovery_setup_required
    RateLimitError:
      type: object
      description: >-
        रेट लिमिट या प्रोग्रेसिव लॉकआउट रिस्पॉन्स। `wait` सेकंड में कूलडाउन अवधि
        है।
      properties:
        detail:
          type: string
          example: >-
            Too many login attempts from this IP address. Please wait before
            trying again.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.