# list

## List of all countries  ⬜ 🟨 🟦 🟩

<mark style="color:blue;">`GET`</mark> `https://api.soccerfootball.info/v1/countries/list/`

This endpoint returns with all countries and the relented entries. You can use this call to get country code and use it in another endpoints.\
The possible format of this call is json or csv (MS office compatible)\
Format CSV is in MS excel compatible mode (double click open without import!)

#### Query Parameters

| Name | Type   | Description                                             |
| ---- | ------ | ------------------------------------------------------- |
| t    | string | Your API Token **`DIRECT API ONLY`**                    |
| f    | string | Format response can be "json" or "csv" (default "json") |

#### Headers

| Name            | Type   | Description                                         |
| --------------- | ------ | --------------------------------------------------- |
| X-RapidAPI-Key  | string | Your API token **`RAPIDAPI ONLY`**                  |
| X-RapidAPI-Host | string | soccerfootballinfo.rapidapi.com **`RAPIDAPI ONLY`** |

{% tabs %}
{% tab title="200 Success response" %}
{% tabs %}
{% tab title="JSON" %}

```javascript
{
   "status":200,
   "errors":[],
   "pagination":[],
   "result":[
      {
         "code":"AF",  // unique country code
         "name":"Afghanistan",
         "timezones":[
            "UTC+04:30"
         ],
         "championships":0, 
         "managers":2,
         "players":13,
         "referees":0,
         "stadiums": 0,
         "teams":4
      },
		...
   ]
}
```

{% endtab %}

{% tab title="CSV" %}

```
code;name;timezones;championships;managers;players;referees;stadiums;teams
AD;Andorra;UTC+01:00;5;32;35;1;7;41
...
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

{% file src="/files/XJTQH8tCM5ZJYoj0jBag" %}

### Example of code for direct API

{% tabs %}
{% tab title="PHP" %}

```php
$url = 'https://api.soccerfootball.info/v1/countries/list/?t=TOKEN';

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_PROXY => null,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_CUSTOMREQUEST => "GET"
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if (!$err) {
  $result = json_decode($response);
  print_r($result);
} else {
	echo "cURL Error:" . $err;
}
```

{% endtab %}

{% tab title="Javascript" %}

```python
fetch("https://api.soccerfootball.info/v1/countries/list/?t=TOKEN", {
	"method": "GET"
})
.then(response => {
	console.log(response);
})
.catch(err => {
	console.error(err);
});
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.soccerfootball.info/v1/countries/list/?t=TOKEN'
};

request(options, function (error, response, body) {
	if (error) throw new Error(error);

	console.log(body);
});
```

{% endtab %}

{% tab title="Phyton" %}

```python
import requests

url = "https://api.soccerfootball.info/v1/countries/list/?t=TOKEN"

response = requests.get(url).json()

print(response)
```

{% endtab %}

{% tab title="cURL" %}

```bash

curl --request GET \
	--url 'https://api.soccerfootball.info/v1/countries/list/?t=TOKEN'

```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.soccerfootball.info/v1/countries/list/?t=TOKEN"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

{% endtab %}
{% endtabs %}

### Example of code for RapidAPI

{% tabs %}
{% tab title="PHP" %}

```php
$url = 'https://soccer-football-info.p.rapidapi.com/countries/list/';

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_PROXY => null,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
		"X-RapidAPI-Host: soccer-football-info.p.rapidapi.com",
		"X-RapidAPI-Key: TOKEN"
	],
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if (!$err) {
  $result = json_decode($response);
  print_r($result);
} else {
	echo "cURL Error:" . $err;
}
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
fetch("https://soccer-football-info.p.rapidapi.com/countries/list/", {
	"method": "GET",
	"headers": {
		"X-RapidAPI-Key": "TOKEN",
		"X-RapidAPI-Host": "soccer-football-info.p.rapidapi.com"
	}
})
.then(response => {
	console.log(response);
})
.catch(err => {
	console.error(err);
});
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const request = require('request');

const options = {
  method: 'GET',
  url: "https://soccer-football-info.p.rapidapi.com/countries/list/",
  headers: {
   "X-RapidAPI-Key": "TOKEN",
	 "X-RapidAPI-Host": "soccer-football-info.p.rapidapi.com"
   useQueryString: true
  }
};

request(options, function (error, response, body) {
	if (error) throw new Error(error);

	console.log(body);
});
```

{% endtab %}

{% tab title="Phyton" %}

```python
import requests

url = "https://soccer-football-info.p.rapidapi.com/countries/list/"

headers = {
    "X-RapidAPI-Key": "TOKEN",
	  "X-RapidAPI-Host": "soccer-football-info.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --request GET \
	--url https://soccer-football-info.p.rapidapi.com/countries/list/ \
	--header 'X-RapidAPI-Host: soccer-football-info.p.rapidapi.com' \
	--header 'X-RapidAPI-Key: TOKEN'
```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://soccer-football-info.p.rapidapi.com/countries/list/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-RapidAPI-Key", "TOKEN")
	req.Header.Add("X-RapidAPI-Host", "soccer-football-info.p.rapidapi.com")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

{% endtab %}
{% endtabs %}

More example of code on [rapidAPI](https://rapidapi.com/soccerfootball-info-soccerfootball-info-default/api/soccer-football-info)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://info.soccerfootball.info/v1/countries/list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
