
<div style='background-color: #f0f4f8; border-left: 4px solid #007acc; padding: 15px 20px; font-family: Arial, sans-serif; font-size: 20px; color: #333;'>
  <strong>7th June 2025 - All API methods are now available for all subscription plans, including the Bronze.</strong>
</div>
<p>&nbsp;</p>

# Get Credit Balance


?> **GET** `{{{v1.server}}}/account/credits`


Get your account’s credit balance.


### Authorization

You need an API key to access this API endpoint. Get your API key [here](https://keywordseverywhere.com/first-install-addon.html).


### Example API Calls

<!-- tabs:start -->

#### ** Bash **

```shell script
curl -H 'Authorization: Bearer {{{v1.apiKey}}}' -H 'Accept: application/json' '{{{v1.server}}}/account/credits'
```


#### ** PHP **

```php
<?php

$ch = curl_init('{{{v1.server}}}/account/credits');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Accept: application/json',
  'Authorization: Bearer {{{v1.apiKey}}}'
));

$data = curl_exec($ch);
$err = curl_error($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200){
  echo "Success!\n\n" . $data;
} else {
  echo "An error occurred.\n\n" . $data;
}
```

#### ** Laravel **

```php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;

/*
 * Execute this command as follows:
 *
 * php artisan get-credits
 */
class GetCreditBalanceCommand extends Command
{

    protected $signature = 'get-credits';

    public function handle()
    {
        $response = Http::withToken('{{{v1.apiKey}}}')
            ->acceptJson()
            ->get('{{{v1.server}}}/account/credits');

        try {
            echo $response->throw()->body();
        } catch (\Exception $e) {
            echo "An error occurred.\n\n" . $e->getMessage();
        }

        return 0;
    }
}
```

#### ** Java **

```java
package org.example;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;

public class GetCreditBalance {

    public static void main(String[] args) throws UnirestException {
        HttpResponse<String> response = Unirest.get("{{{v1.server}}}/account/credits")
                .header("Accept", "application/json")
                .header("Authorization", "Bearer {{{v1.apiKey}}}")
                .asString();
        if (response.getStatus() == 200) {
            System.out.printf("Success.\n\n%s\n", response.getBody());
        } else {
            System.out.printf("An error occurred.\n\n%s\n", response.getBody());
        }
    }
}
```

#### ** Python **

```python
# pip install requests
import requests

my_headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {{{v1.apiKey}}}'
}

response = requests.get('{{{v1.server}}}/account/credits', headers=my_headers)
if response.status_code == 200:
    print('success\n\n' + response.content.decode('utf-8'))
else:
    print("An error occurred\n\n" + response.content.decode('utf-8'))
```

#### ** Ruby **

```ruby
require 'uri'
require 'net/http'
require 'openssl'

endpoint_url = URI("{{{v1.server}}}/account/credits")

http = Net::HTTP.new(endpoint_url.host, endpoint_url.port)
{{^v1_ruby_disable_ssl}}
http.use_ssl = false
{{/v1_ruby_disable_ssl}}

request = Net::HTTP::Get.new(endpoint_url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {{{v1.apiKey}}}'
response = http.request(request)

if response.code == "200"
    puts "Success\n\n%s" % response.read_body
else
    puts "An error occurred\n\n%s" % response.read_body
end
```

#### ** NodeJs **

```js
fetch('{{{v1.server}}}/account/credits', {
    method: 'GET',
    headers: {
        'Accept': 'application/json',
        'Authorization': `Bearer {{{v1.apiKey}}}`
    },
})
    .then((response) => response.text())
    .then((text) => console.log(text))
    .catch(error => {
        console.log(error)
    })
```

#### ** R **

```R
#install.packages(c("httr", "jsonlite"))
library(httr)
library(jsonlite)

res = GET(
    "{{{v1.server}}}/account/credits",
    add_headers('Accept' = 'application/json',
                'Authorization' = 'Bearer {{{v1.apiKey}}}')
)
prettify(content(res, as = "text", encoding = "UTF-8"))
```

#### ** n8n (Custom Node) **



#### Workflow Diagram
![](images/n8n/custom_node/get_credit_balance.png)

#### Steps to Import the Workflow
1. If you haven't done so already, install the **[Keywords Everywhere API](https://www.npmjs.com/package/n8n-nodes-keywords-everywhere-api)** community node in your n8n instance.
2. Copy the JSON below and save it in a file.

  ```json
{{=<% %>=}}
  {
      "name": "Get Credit Balance with Keywords Everywhere API",
      "nodes": [
          {
              "parameters": [],
              "type": "n8n-nodes-base.manualTrigger",
              "typeVersion": 1,
              "position": [
                  560,
                  -440
              ],
              "id": "86cea38d-93a5-42f0-bc46-316addcd74ac",
              "name": "When clicking ‘Test workflow’"
          },
          {
              "parameters": {
                  "resource": "miscellaneous"
              },
              "type": "n8n-nodes-keywords-everywhere-api.keApi",
              "typeVersion": 1,
              "position": [
                  780,
                  -440
              ],
              "id": "d8fa01c6-cc31-4793-bed9-38960c074f18",
              "name": "Get Credit Balance",
              "credentials": {
                  "keApi": {
                      "id": "N2i3rMzytn7OfaN3",
                      "name": "Keywords Everywhere account"
                  }
              }
          }
      ],
      "pinData": [],
      "connections": {
          "When clicking ‘Test workflow’": {
              "main": [
                  [
                      {
                          "node": "Get Credit Balance",
                          "type": "main",
                          "index": 0
                      }
                  ]
              ]
          }
      },
      "active": false,
      "settings": {
          "executionOrder": "v1"
      },
      "versionId": "7b4fa5b9-c760-439b-b91f-e61d0396eb3c",
      "meta": {
          "templateCredsSetupCompleted": true,
          "instanceId": "05035923b4e6188dc7851e2829900eebe8ed69d4f94ad4bab03daf6d88491d90"
      },
      "id": "fb6mxQghbcHEbRgJ",
      "tags": []
  }
<%={{ }}=%>
  ```
3. In your n8n instance, click on the **&#x22EF;** menu at the top right and select the **Import from File** option.
4. Select the JSON file you saved above.
5. Adjust any necessary parameters (e.g., **Keywords Everywhere** credentials).

#### ** n8n (HTTP Request) **


#### Workflow Diagram
![](images/n8n/http_request/get_credit_balance.png)

#### Steps to Recreate the Workflow
1. Start with a **Trigger Node**: e.g., **"Trigger Manually"** to invoke the workflow.
2. Add a **"HTTP Request"** node.
   - Click **"Import cURL"** at the top right of the node editor.
   - Paste the command below and click **"Import"**.
     ```shell
     curl -H 'Authorization: Bearer {{{v1.apiKey}}}' -H 'Accept: application/json' '{{{v1.server}}}/account/credits'
     ```
   - Adjust the authorization header with your **Keywords Everywhere** API key.

     ![](../_media/n8n/authorization_header.png)

3. Adjust any necessary parameters (e.g., you can rename the node to **"Get Credit Balance"**).

#### ** Make.com **

#### Scenario Diagram

![](images/make/get_credit_balance.png)

#### Steps to Recreate the Above Scenario

1. Copy the JSON blueprint below and save it as a file (for example, blueprint.json).
   ```json
   {
       "name": "Get Credit Balance - Keywords Everywhere API",
       "flow": [
           {
               "id": 1,
               "module": "app#keywords-everywhere-api:getCreditBalance",
               "version": 1,
               "parameters": {
                   "__IMTCONN__": 3266898
               },
               "mapper": [],
               "metadata": {
                   "designer": {
                       "x": 0,
                       "y": 0
                   },
                   "restore": {
                       "parameters": {
                           "__IMTCONN__": {
                               "data": {
                                   "scoped": "true",
                                   "connection": "app#keywords-everywhere-api-0p871s"
                               },
                               "label": "Keywords Everywhere Production"
                           }
                       }
                   },
                   "parameters": [
                       {
                           "name": "__IMTCONN__",
                           "type": "account:app#keywords-everywhere-api-0p871s",
                           "label": "Connection",
                           "required": true
                       }
                   ]
               }
           }
       ],
       "metadata": {
           "instant": false,
           "version": 1,
           "scenario": {
               "roundtrips": 1,
               "maxErrors": 3,
               "autoCommit": true,
               "autoCommitTriggerLast": true,
               "sequential": false,
               "slots": null,
               "confidential": false,
               "dataloss": false,
               "dlq": false,
               "freshVariables": false
           },
           "designer": {
               "orphans": []
           },
           "zone": "us2.make.com",
           "notes": []
       }
   }
   ```

2. Sign in at make.com using your credentials.

3. From your dashboard, click **"Scenarios"** in the navigation menu.

4. Click the **"Create a new scenario"** button in the top right.

5. In the scenario editor, click the ellipsis (⋯) menu in the bottom left and select **"Import blueprint."**

   ![](../_media/make/import_blueprint.png)

6. When prompted, click "Browse" (or "Choose file"), then select your blueprint.json file.

7. Adjust any required parameters (such as **Keywords Everywhere** credentials) according to the blueprint.

#### Steps to Add the "Get Credit Balance" to a Pre-Existing Scenario

1. In the scenario editor, click the **"+"** or **"Add another module"** button.

2. In the search field that appears, type **"Keywords Everywhere API."**

3. Select the **"Get Credit Balance"** module from the search results.

4. Follow the on-screen prompts to configure the module with your desired parameters or credentials.

5. Confirm to add the module. It will append to your current scenario without overwriting existing modules.


<!-- tabs:end -->



### Response HTTP Status Codes

| Status Code | Description                      |
|-------------|----------------------------------|
| `200`       | A successful request             |
| `401`       | API key is missing or is invalid |

### Success Response Fields

The response is an array containing your account's credit balance as the only element.

### Sample Success Response

```json
[
    95597755
]
```


