Skip to main content
This guide walks you through making your first successful API call using a POS integration workflow. You’ll authenticate, start an interaction, and be ready to process transactions.
New to authentication? Check out our Authentication Guide to understand OAuth flows, choose the right method, and learn about security best practices.

Prerequisites

Before you begin, make sure you have:
  • A ClearLine account (Demo or Production environment)
  • API credentials (Client ID and Client Secret)
  • A registered POS terminal ID
  • A location ID from your POS system
Don’t have credentials? Contact your ClearLine representative or support@clearline.me to get started.

Step 1: Get Your Access Token

Authenticate using the Client Credentials flow to get an access token:
curl -X POST https://logindemo.clearline.me/connect/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d "grant_type=client_credentials&scope=pos_integration"

Response

access_token
string
required
JWT token for authenticating API requests. Include this in the Authorization: Bearer {token} header for all subsequent API calls. Example: eyJhbGciOiJSUzI1NiIsImtpZCI6Ij...
token_type
string
required
Token type, always Bearer for OAuth2 tokens.
expires_in
integer
required
Token lifetime in seconds. Default is 3600 (1 hour). Request a new token before expiration.
scope
string
required
The granted OAuth scope. Should match your requested scope: pos_integration
Save this token! You’ll use it in all subsequent API calls. It’s valid for 1 hour (3600 seconds).
For other authentication methods (user apps, mobile apps, etc.), see the complete Authentication Guide.

Step 2: Start Your First Interaction

Now make your first API call to start a customer interaction:
curl -X POST https://public-api-demo.clearline.me/pos/clover/startInteraction \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "terminalID": "YOUR_TERMINAL_ID",
    "posLocationId": "YOUR_LOCATION_ID"
  }'

Response

data
object
required
Container object for the interaction response data.
Terminal Not Registered? If you get a 404 error, your terminal ID needs to be registered in the ClearLine Admin Portal first.

Next Steps

Now that you’ve made your first successful API call, you can:

Common Issues

Cause: Invalid or expired access token Solution: - Verify your Client ID and Client Secret are correct - Check that you’re using the right environment (demo vs production) - Request a new access token if it expired
Cause: Terminal ID not registered in ClearLine Solution: - Log into the ClearLine Admin Portal - Navigate to Terminals - Register your terminal ID
  • Wait a few minutes for sync, then try again
Cause: Network issues or wrong environment URL Solution: - Verify you’re using the correct base URL for your environment - Check your network firewall settings - Try the demo environment first: public-api-demo.clearline.me

Complete Example

Here’s a complete working example that authenticates and starts an interaction:
async function quickStart() {
  // Step 1: Authenticate
  const credentials = btoa('YOUR_CLIENT_ID:YOUR_CLIENT_SECRET');
  
  const authResponse = await fetch(
    'https://logindemo.clearline.me/connect/token',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': `Basic ${credentials}`
      },
      body: 'grant_type=client_credentials&scope=pos_integration'
    }
  );
  
  const authData = await authResponse.json();
  const accessToken = authData.access_token;
  
  console.log('✓ Authenticated successfully');
  
  // Step 2: Start Interaction
  const interactionResponse = await fetch(
    'https://public-api-demo.clearline.me/pos/clover/startInteraction',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${accessToken}`
      },
      body: JSON.stringify({
        terminalID: 'YOUR_TERMINAL_ID',
        posLocationId: 'YOUR_LOCATION_ID'
      })
    }
  );
  
  const interactionData = await interactionResponse.json();
  const sessionId = interactionData.data.sessionId;
  
  console.log('✓ Session started:', sessionId);
  console.log('✓ Ready to process transactions!');
  
  return { accessToken, sessionId };
}

// Run it
quickStart().catch(console.error);


What’s Next?

1

Send a Transaction

Use your sessionId to submit transaction data View Transaction Endpoints →
2

Implement Error Handling

Add retry logic and proper error handling View Error Handling Guide →
3

Go to Production

Switch to production URLs and credentials View Environments →
Need Help? Check out the complete transaction workflow guide for detailed implementation steps with diagrams and best practices.