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

# API reference

> API contract का उपयोग करें, writes को सुरक्षित रूप से retry करें, और errors को सुसंगत रूप से संभालें।

API Reference Swipelux API के लिए प्रामाणिक contract है। प्रत्येक operation अपने request, response, security, status, और error schemas दिखाता है।

प्रत्येक request के लिए `https://platform.swipelux.com` का उपयोग करें। एक सुरक्षित backend से `X-API-Key` में अपनी environment-specific key भेजें।

## Writes को retry के लिए सुरक्षित बनाएँ

जब कोई operation `Idempotency-Key` को आवश्यक के रूप में सूचीबद्ध करता है, तो प्रत्येक इच्छित operation के लिए एक key जनरेट करें और उसे अपने local request record के साथ संग्रहीत करें।

```bash theme={null}
curl --request POST \
  'https://platform.swipelux.com/v3/customers' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Idempotency-Key: customer-order-1001' \
  --header 'Content-Type: application/json' \
  --data '{"type":"individual","externalId":"customer-order-1001"}'
```

यदि response अनिश्चित है, तो उसी method, path, और body को उसी key के साथ retry करें। उस key का किसी अलग operation या बदले हुए body के लिए पुन: उपयोग न करें।

कुछ operations `Idempotency-Replayed: true` लौटाते हैं जब response उसी key वाले किसी पहले request से आया हो। उस response को मूल operation के परिणाम के रूप में मानें, दूसरे operation के रूप में नहीं।

## Errors को संभालें

API errors `application/problem+json` का उपयोग करते हैं। इन स्थिर fields के आसपास client behavior बनाएँ:

| Field              | उपयोग                                                                |
| ------------------ | -------------------------------------------------------------------- |
| `status`           | समस्या से जुड़ा HTTP status।                                         |
| `code`             | स्थिर machine-readable error code।                                   |
| `detail`           | वर्तमान request के लिए कार्रवाई योग्य स्पष्टीकरण।                    |
| `retryable`        | जब मौजूद हो, तो क्या उसी request को retry करने पर सफलता मिल सकती है। |
| `errors[].pointer` | एक अमान्य request field के लिए JSON Pointer।                         |
| `correlationId`    | logs और support records में रखने के लिए request identifier।          |

Response `correlationId` `X-Request-Id` को mirror करता है। दोनों operation और इस मान को log करें, लेकिन secrets या पूरी वित्तीय जानकारी उजागर न करें।

```json theme={null}
{
  "type": "https://docs.swipelux.com/problems/validation_error",
  "title": "Validation error",
  "status": 400,
  "code": "validation_error",
  "detail": "The request contains invalid fields.",
  "correlationId": "01JERRORVALIDATION",
  "errors": [
    {
      "pointer": "/externalId",
      "code": "invalid_format",
      "message": "Use a valid external identifier."
    }
  ]
}
```

Operation के दस्तावेज़ीकृत problem schemas का उपयोग करके तय करें कि input को सही करना है, resource state को refresh करना है, कार्य पूरा करना है, या retry करना है। पूर्ण status और error catalog को API Reference में रखें, बजाय undocumented cases को hard-code करने के।

## Asynchronous operations को track करें

एक सफल create response कई workflows शुरू करता है; यह पूर्णता की गारंटी नहीं देता। Response से प्राप्त resource IDs संग्रहीत करें, वर्तमान resource पढ़ें, और परिवर्तनों पर प्रतिक्रिया करने के लिए [verified webhooks](/hi/integration/webhooks) का उपयोग करें।

[`POST /v3/customers`](/api-reference/customers/post-v3-customers) से शुरू करें, या पूर्ण sandbox यात्रा के लिए [Quickstart](/hi/integration/quickstart) का पालन करें।


## Related topics

- [Individual onboarding API workflow](/hi/knowledge-base/individual-onboarding/api-workflow.md)
- [Integration अवलोकन](/hi/integration/overview.md)
- [Recipients और destinations](/hi/integration/recipients.md)
- [Go live](/hi/integration/go-live.md)
- [Quickstart](/hi/integration/quickstart.md)
