# Calling APIs Registered in digiRunner with Basic Auth

After obtaining the client registration in digiRunner, TSP can utilize the associated permissions stored within this client to call APIs registered in digiRunner.

### Workflow

<div align="left"><figure><img src="https://content.gitbook.com/content/PMARh9UJ4Cb9Ol9ruYUw/blobs/PcqoKnBv9frUbdJGaL4r/4_1_1.png" alt=""><figcaption></figcaption></figure></div>

Example request:

```
curl -v -X POST 'https://{digiRunner_DOMAIN}/tsmpc/tspTest/postApi' \
-H 'Accept: application/json' \
-H 'Authorization: Basic {client_secret_2}'
```

Parameters with details:

<table><thead><tr><th width="200">Parameter</th><th width="79">Type</th><th width="131">Requirement</th><th>Description</th></tr></thead><tbody><tr><td><code>client_secret_2</code></td><td>String</td><td>Required</td><td><p>1. After registering the client ID with digiRunner, append ":" and the client password, then encode it in Base64 and use it as the Value.</p><p>2. Example:</p><p>Client ID: tspclient</p><p>Client Password: tsp123abcd</p><p>Formula for generating the value:</p><p>Base64 Encode(ClientID+":"+Client Password)</p><p>Base64 Encode(tspclient:tsp123abcd)</p><p>Output for client_secret_2:</p><p>dHNwY2xpZW50OnRzcDEyM2FiY2Q=</p></td></tr></tbody></table>

### Example of Error Response

If the client password is incorrect, a 401 Unauthorized HTTP status code and JSON response will be returned.

Example:&#x20;

```
{
    "timestamp": "1685945360673",
    "status": 401,
    "error": "Unauthorized",
    "message": "The client account or password is incorrect. clientId: tspclient",
    "path": "/tsmpc/miniTest/bustaxi2"
}
```
