Swift π¦
Installation
Swift Package Manager
dependencies: [
.package(url: "https://github.com/CardScan-ai/api-clients.git", from: "1.0.0")
]Basic Usage
import CardScanClient
// Initialize with your API key
let apiKey = "sk_test_cardscan_ai_..."
let client = CardScanAPI(apiKey: apiKey)
// Generate a session token for a user
do {
let tokenResponse = try await client.getAccessToken(userId: "unique-user-123")
let sessionToken = tokenResponse.Token
let identityId = tokenResponse.IdentityId
let sessionId = tokenResponse.session_id
// Initialize client with session token for frontend operations
let userClient = CardScanAPI(sessionToken: sessionToken, live: false)
} catch {
print("Error creating access token: \(error)")
}Card Scanning Workflow
1. Create a Card
2. Generate Upload URL
3. Upload Image
4. Poll for Results
Error Handling
WebSocket Support
Eligibility Verification
SwiftUI Integration
Combine Support
Configuration
Source Code
Last updated
Was this helpful?