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

# cURL Examples

# cURL Examples

Command-line examples for all Ozura Vault endpoints.

## Setup

Set your API key as an environment variable:

```bash theme={null}
export OZURA_API_KEY="key_your_api_key_here"
export OZURA_PUB_KEY="pk_your_pub_key_here"
export VAULT_URL="$YOUR_VAULT_URL"
```

## Tokenization

### Tokenize a Card

```bash theme={null}
curl -X POST "$VAULT_URL/tokenize" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -H "X-Pub-Key: $OZURA_PUB_KEY" \
  -d '{
    "type": "card",
    "data": {
      "cardNumber": "4111111111111111",
      "expirationMonth": "12",
      "expirationYear": "2025",
      "cvv": "123"
    }
  }'
```

### Tokenize a Bank Account

```bash theme={null}
curl -X POST "$VAULT_URL/tokenize" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -H "X-Pub-Key: $OZURA_PUB_KEY" \
  -d '{
    "type": "bank",
    "data": {
      "accountNumber": "1234567890",
      "routingNumber": "021000021",
      "accountType": "checking"
    }
  }'
```

### Create Test Token

```bash theme={null}
curl -X POST "$VAULT_URL/test-tokens" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -H "X-Pub-Key: $OZURA_PUB_KEY" \
  -d '{
    "type": "card",
    "data": {
      "cardNumber": "4111111111111111",
      "expirationMonth": "12",
      "expirationYear": "2025",
      "cvv": "123"
    }
  }'
```

## Detokenization

```bash theme={null}
curl -X POST "$VAULT_URL/detokenize" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -d '{
    "token": "tok_your_token_here"
  }'
```

## Proxy

### JSON Proxy (Stripe)

```bash theme={null}
curl -X POST "$VAULT_URL/proxy/transaction" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -d '{
    "token": "tok_your_token_here",
    "cvc_session_id": "your_cvc_session_id",
    "proxy_url": "https://api.stripe.com/v1/charges",
    "request_data": {
      "amount": 2000,
      "currency": "usd",
      "source": {
        "object": "card",
        "number": "${cardNumber}",
        "exp_month": "${expirationMonth}",
        "exp_year": "${expirationYear}",
        "cvc": "${cvv}"
      }
    },
    "http_headers": {
      "Authorization": "Bearer sk_test_your_stripe_key"
    }
  }'
```

### XML Proxy

```bash theme={null}
curl -X POST "$VAULT_URL/proxy/transaction" \
  -H "Content-Type: text/xml" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -H "X-Token: tok_your_token_here" \
  -H "X-Proxy-URL: https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp" \
  -H "X-CVC-Session-ID: your_cvc_session_id" \
  -d '<?xml version="1.0" encoding="UTF-8"?>
<paymentService version="1.4" merchantCode="MERCHANT">
  <submit>
    <order orderCode="ORDER123">
      <amount value="1000" currencyCode="USD"/>
      <paymentDetails>
        <CARD-SSL>
          <cardNumber>${cardNumber}</cardNumber>
          <expiryDate>
            <date month="${expirationMonth}" year="${expirationYear}"/>
          </expiryDate>
          <cvc>${cvv}</cvc>
        </CARD-SSL>
      </paymentDetails>
    </order>
  </submit>
</paymentService>'
```

## API Key Verification

```bash theme={null}
curl -X GET "$VAULT_URL/api/applications/key" \
  -H "X-API-Key: $OZURA_API_KEY"
```

## Authentication

### Login

```bash theme={null}
curl -X POST "$VAULT_URL/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "yourPassword123!"
  }'
```

### Verify MFA

```bash theme={null}
curl -X POST "$VAULT_URL/auth/mfa/verify" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "code": "123456"
  }'
```

### Verify Session

```bash theme={null}
curl -X GET "$VAULT_URL/auth/verify" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Tokens Management

### List Tokens

```bash theme={null}
curl -X GET "$VAULT_URL/tokens" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### List Tokens with Filters

```bash theme={null}
curl -X GET "$VAULT_URL/tokens?type=card&page=1&limit=20" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Delete Token

```bash theme={null}
curl -X DELETE "$VAULT_URL/tokens/tok_your_token_here" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Applications

### Create Application

```bash theme={null}
curl -X POST "$VAULT_URL/api/applications" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "name": "My Application",
    "permissions": {
      "tokenization": { "allowed": true },
      "provisioning": { "allowed": false }
    }
  }'
```

### List Applications

```bash theme={null}
curl -X GET "$VAULT_URL/api/applications" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Delete Application

```bash theme={null}
curl -X DELETE "$VAULT_URL/api/applications/app_id_here" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Projects

### Create Project

```bash theme={null}
curl -X POST "$VAULT_URL/projects/create" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "name": "My Project",
    "description": "Production environment"
  }'
```

### List Projects

```bash theme={null}
curl -X GET "$VAULT_URL/projects" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Invite Member

```bash theme={null}
curl -X POST "$VAULT_URL/projects/proj_id_here/invite" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "email": "newmember@example.com",
    "role": "member"
  }'
```

## Provisioning

```bash theme={null}
curl -X POST "$VAULT_URL/internal/provision" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $OZURA_API_KEY" \
  -d '{
    "project_name": "Customer Acme Corp",
    "user_email": "admin@acme.com"
  }'
```

## Settings

### Get Settings

```bash theme={null}
curl -X GET "$VAULT_URL/user/settings" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Update Settings

```bash theme={null}
curl -X PUT "$VAULT_URL/user/settings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "deduplication_enabled": true
  }'
```

## MFA

### Enable MFA

```bash theme={null}
curl -X POST "$VAULT_URL/user/settings/mfa" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Verify MFA Setup

```bash theme={null}
curl -X POST "$VAULT_URL/user/settings/mfa/verify" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "code": "123456"
  }'
```

### Disable MFA

```bash theme={null}
curl -X DELETE "$VAULT_URL/user/settings/mfa" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "code": "123456"
  }'
```

## Audit Logs

### Get Audit Logs

```bash theme={null}
curl -X GET "$VAULT_URL/audit-logs" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Filter Audit Logs

```bash theme={null}
curl -X GET "$VAULT_URL/audit-logs?event_type=TOKEN_CREATION&start_date=2024-01-01&limit=100" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Tips

### Pretty Print JSON

```bash theme={null}
curl ... | jq .
```

### Save Response to File

```bash theme={null}
curl ... -o response.json
```

### Verbose Output

```bash theme={null}
curl -v ...
```

### Time the Request

```bash theme={null}
time curl ...
```

## Next Steps

* [JavaScript Examples](javascript.md) - Node.js client
* [Python Examples](python.md) - Python client


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