> ## 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.

# मॉनिटरिंग SDK टोकन API बनाएं

> Didit के साथ एक विषय से जुड़ा अल्पकालिक डिवाइस क्रेडेंशियल बनाएं, ताकि आपका ऐप API कुंजी उजागर किए बिना निगरानी इवेंट भेज सके।



निगरानी SDK token API प्रॉम्प्ट जारी करें
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\`Mint a short-lived device credential so my web or mobile app can send monitoring events for one user straight to Didit.

Endpoint:
POST https://verification.didit.me/v3/events/sdk-token/

Authentication:
Use the x-api-key header with my Didit API key. This call runs on MY BACKEND only - the API key must never ship in an app. Only the returned monitoring_token travels to the device. A scoped key needs transactions: write.

Goal:
\- Get a monitoring_token for the signed-in user. The app sends it in the X-Monitoring-Token header to the device lane (POST /v1/events/ and POST /v1/events/batch/).

Request body (application/json):
\{
"vendor_data": "user-42",                                  // required - the subject every event belongs to
"entity_type": "individual",                               // optional - company binds a company; any other value an individual (default)
"allowed_event_categories": ["auth", "session", "gameplay"], // optional - omit or [] for every category
"ttl_seconds": 900,                                        // optional - 60 to 86400, default 900
"max_uses": 1000,                                          // optional - events it may submit, default 1000, null for no cap
"bind_to_origin": "https://app.example.com"                // optional - browser Origin must match exactly
}
camelCase aliases (vendorData, entityType, allowedEventCategories, ttlSeconds, maxUses, bindToOrigin) are also accepted.

Behavior:
\- The subject is bound server-side: whatever subject the app sends is overwritten with vendor_data.
\- One use per submitted event, also inside a batch: a 500-event flush spends 500 uses, and events the device lane rejects spend uses too.
\- An event outside allowed_event_categories is rejected by the device lane with 400.
\- With bind_to_origin set, a device request with a different Origin, or none, is refused.
\- Minting does not create a user.
\- Event ingestion must be switched on for the application, otherwise this call returns 403 with code event_monitoring_disabled.

Example call:
curl -X POST "https://verification.didit.me/v3/events/sdk-token/" \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"vendor_data":"user-42","allowed_event_categories":["auth","session","gameplay"],"ttl_seconds":900,"max_uses":1000}'

What to read from the response:
\- monitoring_token - hand it to the app; treat it as a secret for its lifetime.
\- expires_at - mint a fresh credential per user session before it expires.
\- allowed_event_categories ([] means every category), max_uses (null means no cap), bind_to_origin.

Failure modes:
\- 400 - missing vendor_data, ttl_seconds outside 60-86400, max_uses below 1, or an unknown category.
\- 401 - the API key has expired.
\- 403 - missing API key (a wrong, revoked or expired key gets 401), a scoped key without transactions: write, or code event_monitoring_disabled.

Side effects: creates one credential. Nothing else changes.

For the full client-side submission guide, see /transaction-monitoring/sdk-event-submission.`

\</pre>



      
      

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

इस क्रेडेंशियल का उपयोग डिवाइस लेन करती है, जिसका वर्णन [SDK इवेंट सबमिशन](https://docs.didit.me/hi/transaction-monitoring/sdk-event-submission.md) में है। उसमें यह भी सूचीबद्ध है कि सर्वर हर डिवाइस अनुरोध पर क्या लागू करता है और बैकप्रेशर के तहत कौन-से इवेंट सुरक्षित रूप से छोड़े जा सकते हैं।


## OpenAPI

````yaml hi/openapi-25.json POST /v3/events/sdk-token/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: पहचान सत्यापन API। x-api-key हेडर के साथ प्रमाणीकृत करें।
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/events/sdk-token/:
    post:
      tags:
        - Monitoring Events
      summary: मॉनिटरिंग SDK token मिंट करें
      description: >-
        एक विषय से बंधा हुआ अल्पकालिक डिवाइस क्रेडेंशियल मिंट करें, ताकि आपका
        वेब या मोबाइल ऐप API कुंजी के बिना उस उपयोगकर्ता के इवेंट्स सीधे Didit
        को भेज सके। ऐप लौटाए गए `monitoring_token` को `X-Monitoring-Token` हेडर
        में डिवाइस लेन (`POST /v1/events/` और `POST /v1/events/batch/`) पर भेजता
        है, जहां विषय को हमेशा इस `vendor_data` से ओवरराइट किया जाता है,
        `allowed_event_categories` से बाहर के इवेंट्स अस्वीकार कर दिए जाते हैं,
        सबमिट किया गया प्रत्येक इवेंट एक उपयोग खर्च करता है, और जिस अनुरोध का
        `Origin` `bind_to_origin` के बराबर नहीं होता है उसे अस्वीकार कर दिया
        जाता है। इसे केवल अपने बैकएंड से कॉल करें; मिंटिंग केवल क्रेडेंशियल
        बनाती है और कुछ नहीं (कोई उपयोगकर्ता नहीं बनाया जाता है)। एप्लिकेशन के
        लिए इवेंट इनजेशन चालू होना चाहिए, अन्यथा यह endpoint ऐसा क्रेडेंशियल
        मिंट करने के बजाय जो कभी लिख नहीं सकता, `code:
        event_monitoring_disabled` के साथ `403` लौटाता है। स्कोप्ड API कुंजी को
        `transactions: write` की आवश्यकता होती है। [SDK इवेंट
        सबमिशन](https://docs.didit.me/hi/transaction-monitoring/sdk-event-submission)
        देखें।
      operationId: create_monitoring_event_sdk_token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                camelCase उपनाम स्वीकार किए जाते हैं: `vendorData`,
                `entityType`, `allowedEventCategories`, `ttlSeconds`, `maxUses`,
                `bindToOrigin`।
              required:
                - vendor_data
              properties:
                vendor_data:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: >-
                    उस विषय के लिए आपकी id, जिससे इस क्रेडेंशियल के साथ सबमिट
                    किया गया प्रत्येक इवेंट संबंधित है।
                entity_type:
                  type: string
                  maxLength: 32
                  default: individual
                  description: >-
                    `company` एक कंपनी सब्जेक्ट को संबद्ध करता है; कोई अन्य मान
                    (डिफ़ॉल्ट `individual`) एक व्यक्ति को संबद्ध करता है।
                allowed_event_categories:
                  type: array
                  items:
                    type: string
                    enum:
                      - auth
                      - session
                      - gameplay
                      - bonus
                      - affiliate
                      - payment
                      - dispute
                      - security
                      - responsible_gambling
                      - custom
                  description: >-
                    वे श्रेणियां जिन्हें क्रेडेंशियल सबमिट कर सकता है। प्रत्येक
                    श्रेणी की अनुमति देने के लिए इसे छोड़ दें या `[]` भेजें।
                ttl_seconds:
                  type: integer
                  minimum: 60
                  maximum: 86400
                  default: 900
                  description: क्रेडेंशियल का लाइफ़टाइम सेकंड में।
                max_uses:
                  type: integer
                  minimum: 1
                  nullable: true
                  default: 1000
                  description: >-
                    क्रेडेंशियल द्वारा सबमिट किए जा सकने वाले इवेंट्स की संख्या
                    (एक बैच प्रति इवेंट एक उपयोग खर्च करता है)। लाइफ़टाइम के
                    भीतर कोई सीमा न रखने के लिए `null` भेजें।
                bind_to_origin:
                  type: string
                  maxLength: 255
                  nullable: true
                  description: >-
                    सेट होने पर, प्रत्येक डिवाइस अनुरोध का ब्राउज़र `Origin`
                    हेडर इस मान के बिल्कुल बराबर होना चाहिए; बिना `Origin` वाले
                    अनुरोध को अस्वीकार कर दिया जाता है।
            example:
              vendor_data: user-42
              allowed_event_categories:
                - auth
                - session
                - gameplay
              ttl_seconds: 900
              max_uses: 1000
              bind_to_origin: https://app.example.com
      responses:
        '201':
          description: >-
            क्रेडेंशियल मिंट किया गया था। ऐप को `monitoring_token` दें और
            `expires_at` तक इसे सीक्रेट मानें।
          content:
            application/json:
              schema:
                type: object
                required:
                  - monitoring_token
                  - expires_at
                  - allowed_event_categories
                  - max_uses
                  - bind_to_origin
                properties:
                  monitoring_token:
                    type: string
                    description: >-
                      डिवाइस क्रेडेंशियल (43-वर्ण वाला URL-सुरक्षित token)। इसे
                      `X-Monitoring-Token` हेडर में भेजें।
                  expires_at:
                    type: string
                    format: date-time
                    description: जब क्रेडेंशियल स्वीकार किया जाना बंद हो जाता है।
                  allowed_event_categories:
                    type: array
                    items:
                      type: string
                      enum:
                        - auth
                        - session
                        - gameplay
                        - bonus
                        - affiliate
                        - payment
                        - dispute
                        - security
                        - responsible_gambling
                        - custom
                    description: >-
                      वे श्रेणियां जिन्हें क्रेडेंशियल सबमिट कर सकता है; `[]` का
                      अर्थ प्रत्येक श्रेणी है।
                  max_uses:
                    type: integer
                    nullable: true
                    description: क्रेडेंशियल का इवेंट बजट; null का अर्थ कोई सीमा नहीं है।
                  bind_to_origin:
                    type: string
                    nullable: true
                    description: ऑरिजिन जिससे क्रेडेंशियल जुड़ा है, या null।
              example:
                monitoring_token: q7ZtR2xKp9VbN4mWc8LdH1sYfJ3gT6uEaQ0oPiXzBkC
                expires_at: '2026-10-17T09:30:02.481000Z'
                allowed_event_categories:
                  - auth
                  - session
                  - gameplay
                max_uses: 1000
                bind_to_origin: https://app.example.com
        '400':
          description: >-
            सत्यापन विफल रहा: अनुपलब्ध `vendor_data`, 60 से 86400 के बाहर
            `ttl_seconds`, 1 से कम `max_uses`, या एक अज्ञात श्रेणी (एरे में उसकी
            स्थिति के आधार पर कुंजीबद्ध)।
          content:
            application/json:
              examples:
                Missing vendor_data:
                  value:
                    vendor_data:
                      - This field is required.
                ttl_seconds too short:
                  value:
                    ttl_seconds:
                      - Ensure this value is greater than or equal to 60.
                Unknown category:
                  value:
                    allowed_event_categories:
                      '1':
                        - '"login" is not a valid choice.'
        '401':
          description: >-
            स्कोप्ड API कुंजी की समय-सीमा समाप्त हो गई है। केवल समय-सीमा समाप्त
            कुंजी को `401` मिलता है; अनुपलब्ध या अमान्य कुंजी को `403` मिलता है।
          content:
            application/json:
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            अनुपस्थित `x-api-key` (गलत, निरस्त या समाप्त कुंजी को `401` मिलता
            है), बिना `transactions: write` वाली स्कोप्ड कुंजी, कुछ वर्कफ़्लो या
            स्वीकृत सत्रों तक सीमित कुंजी (ऐसी कुंजी लेन-देन निगरानी डेटा तक कभी
            नहीं पहुँचती), या कुंजी की IP अनुमति सूची के बाहर से किया गया
            अनुरोध। एप्लिकेशन के लिए इवेंट इनजेशन बंद होने पर `code:
            event_monitoring_disabled` के साथ भी लौटाया जाता है; उस स्थिति में
            कुछ भी संग्रहीत नहीं किया जाता है, और यह जाँच अनुरोध के मुख्य भाग के
            मान्य होने से पहले चलती है।
          content:
            application/json:
              examples:
                Event monitoring disabled:
                  value:
                    detail: >-
                      Event monitoring is not enabled for this application. Turn
                      on event ingestion in the transaction monitoring settings
                      before submitting events.
                    code: event_monitoring_disabled
                Missing or invalid API key:
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without access:
                  value:
                    detail: This API key has no write access to transactions.
                Key limited to workflows or approved sessions:
                  value:
                    detail: >-
                      This API key only reaches sessions inside its workflow or
                      status limits, so it can't use this endpoint.
                IP not allowed:
                  value:
                    detail: This API key can't be used from this IP address.
        '429':
          description: >-
            रेट लिमिट पार हो गई: राइट (write) अनुरोध (`POST`, `PATCH`, `DELETE`)
            प्रति API कुंजी प्रति मिनट 300 अनुरोधों का बजट साझा करते हैं।
            `Retry-After` सेकंड प्रतीक्षा करें, फिर पुनः प्रयास करें।
          headers:
            Retry-After:
              description: पुनः प्रयास करने से पहले प्रतीक्षा करने के सेकंड।
              schema:
                type: integer
                minimum: 1
                example: 30
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X POST 'https://verification.didit.me/v3/events/sdk-token/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                "vendor_data": "user-42",
                "allowed_event_categories": ["auth", "session", "gameplay"],
                "ttl_seconds": 900,
                "max_uses": 1000,
                "bind_to_origin": "https://app.example.com"
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.monitoring_events.create_sdk_token(
                vendor_data="user-42",
                allowed_event_categories=["auth", "session", "gameplay"],
                ttl_seconds=900,
                max_uses=1000,
                bind_to_origin="https://app.example.com",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY.
            const didit = new Didit();

            const result = await didit.monitoringEvents.createSdkToken({
              vendor_data: "user-42",
              allowed_event_categories: ["auth", "session", "gameplay"],
              ttl_seconds: 900,
              max_uses: 1000,
              bind_to_origin: "https://app.example.com",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.MonitoringEvents.CreateSDKToken(ctx, didit.MonitoringEventsCreateSDKTokenParams{\n\tVendorData:             \"user-42\",\n\tAllowedEventCategories: didit.Some([]didit.MonitoringEventsCreateSDKTokenParamsAllowedEventCategories{\"auth\", \"session\", \"gameplay\"}),\n\tTTLSeconds:             didit.Int(900),\n\tMaxUses:                didit.Int(1000),\n\tBindToOrigin:           didit.String(\"https://app.example.com\"),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.util.List;

            import me.didit.Didit;

            import me.didit.types.MonitoringEventsCreateSdkTokenParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.monitoringEvents().createSdkToken(MonitoringEventsCreateSdkTokenParams.builder()
                    .vendorData("user-42")
                    .allowedEventCategories(List.of(MonitoringEventsCreateSdkTokenParams.AllowedEventCategories.of("auth"), MonitoringEventsCreateSdkTokenParams.AllowedEventCategories.of("session"), MonitoringEventsCreateSdkTokenParams.AllowedEventCategories.of("gameplay")))
                    .ttlSeconds(900L)
                    .maxUses(1000L)
                    .bindToOrigin("https://app.example.com")
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY.
            $didit = new DiditClient();

            $result = $didit->monitoringEvents->createSdkToken([
                'vendor_data' => 'user-42',
                'allowed_event_categories' => ['auth', 'session', 'gameplay'],
                'ttl_seconds' => 900,
                'max_uses' => 1000,
                'bind_to_origin' => 'https://app.example.com',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.monitoring_events.create_sdk_token(
              vendor_data: "user-42",
              allowed_event_categories: ["auth", "session", "gameplay"],
              ttl_seconds: 900,
              max_uses: 1000,
              bind_to_origin: "https://app.example.com"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await client.MonitoringEvents.CreateSdkTokenAsync(new
            MonitoringEventsCreateSdkTokenParams

            {
                VendorData = "user-42",
                AllowedEventCategories = new MonitoringEventsCreateSdkTokenParamsAllowedEventCategories[] { "auth", "session", "gameplay" },
                TtlSeconds = 900,
                MaxUses = 1000,
                BindToOrigin = "https://app.example.com",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        आपकी एप्लिकेशन की API कुंजी, Business Console में Developers -> API keys
        से। प्राथमिक कुंजी के पास पूर्ण एक्सेस होता है। एक नामित कुंजी को स्कोप
        किया जा सकता है: प्रति संसाधन none, read या write, कुछ वर्कफ़्लो या
        स्वीकृत सत्रों तक सीमित, IP पतों की सूची तक सीमित, और समाप्ति तिथि तक
        सीमित। 401 का अर्थ है कि कुंजी गलत है, निरस्त कर दी गई है या उसकी
        समय-सीमा समाप्त हो गई है; 403 का अर्थ है कि कोई कुंजी नहीं भेजी गई थी,
        कुंजी के पास इस संसाधन या कार्रवाई का एक्सेस नहीं है, या अनुरोध उसकी IP
        सूची से बाहर के पते से आया था; सत्र रूट पर 404 का अर्थ है कि सत्र कुंजी
        के वर्कफ़्लो या स्थितियों से बाहर है। मीडिया एक्सेस के बिना एक कुंजी को
        छवि, वीडियो और PDF URL null के रूप में प्राप्त होते हैं, और सत्र write
        के बिना एक कुंजी को सत्र लिंक और token null के रूप में प्राप्त होते हैं।
        देखें https://docs.didit.me/console/api-keys।

````

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