Quickstart

This guide will get you all set up and ready to use the Swypex Partner API. We'll cover how to get started, authenticate your requests, and make your first API call. We'll also look at where to go next to find all the information you need to take full advantage of the API.

Authentication

The Swypex Partner API uses OAuth 2.0 Client Credentials Flow for authentication. Before making API requests, you need to obtain an access token.

Get your access token

Exchange your client credentials for an access token:

curl -X POST https://p.swypex.com/v1/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id={your_client_id}" \
  -d "client_secret={your_client_secret}" \
  -d "scope=cards:read cards:write"

The response will include your access token:

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "cards:read cards:write"
}

Making your first API request

After obtaining your access token you're ready to make your first call to the Swypex Partner API. Below, you can see how to send a GET request to the Cards endpoint to get a list of all cards.

GET
/v1/card
curl -G https://p.swypex.com/v1/card \
  -H "Authorization: Bearer {access_token}" \
  -d limit=10

You'll receive a response with an array of cards:

{
  "cards": [
    {
      "id": "CRD1000000000",
      "last4": "1234",
      "nickname": "Business Travel Card",
      "cardHolder": {
        "id": "USR1000000000",
        "fullName": "Sara Amr"
      },
      "limits": {
        "daily": 500000,
        "monthly": 2000000,
        "atm": 400000,
        "approval_based": null
      }
    }
    // ... more cards
  ],
  "nextCursor": "eyJpZCI6IkNSRDEwMDAwMDAwMDkifQ=="
}

Understanding card limits

All card spending limits in the API are expressed in cents, not pounds. For example:

  • 500000 cents = EGP 5,000.00
  • 2000000 cents = EGP 20,000.00
  • 100000000 cents = EGP 1,000,000.00

When updating card limits, always convert whole amounts to cents by multiplying by 100.

What's next?

Great, you're now set up and have made your first request to the API. Here are a few links that might be handy as you venture further:

Was this page helpful?