> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.yoco.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.yoco.com/_mcp/server.

# Authentication

All requests to the API must include a valid authentication token.

Attach the authentication token as a bearer token in the `Authorization` header.

*Example:*

### Request

GET [https://api.yoco.com/v1/orders/](https://api.yoco.com/v1/orders/)

**`Retrieved`**

```curl Retrieved
curl https://api.yoco.com/v1/orders/ \
     -H "Authorization: Bearer <token>"
```

**`Retrieved`**

```python Retrieved
import requests

url = "https://api.yoco.com/v1/orders/"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

**`Retrieved`**

```javascript Retrieved
const url = 'https://api.yoco.com/v1/orders/';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Retrieved`**

```go Retrieved
package main

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

func main() {

	url := "https://api.yoco.com/v1/orders/"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

**`Retrieved`**

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

url = URI("https://api.yoco.com/v1/orders/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

**`Retrieved`**

```java Retrieved
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.yoco.com/v1/orders/")
  .header("Authorization", "Bearer <token>")
  .asString();
```

**`Retrieved`**

```php Retrieved
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.yoco.com/v1/orders/', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

**`Retrieved`**

```csharp Retrieved
using RestSharp;

var client = new RestClient("https://api.yoco.com/v1/orders/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

**`Retrieved`**

```swift Retrieved
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.yoco.com/v1/orders/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

Yoco API supports two types of authentication tokens:

* API keys - Obtained via the [Yoco Developer Console](https://developer.yoco.com/ui/) by generating
  them for your application.
* OAuth 2.0 tokens - Obtained via the [OAuth 2.0 flow](/docs/api/authentication/oauth).

## API keys

API keys enable an application to access its own resources on the Yoco API, or resources belonging
to a single business owned by the developer.

For example:

* A personal application created by a business owner to access their own business' data.
* An OAuth application managing its own settings, such as webhooks.

API keys are preferable when building applications that only require access to a single business.

Learn more

## OAuth 2.0 access tokens

[OAuth 2.0](/docs/api/authentication/oauth) is an open standard designed to allow a website or
application access to your information.

With OAuth, other users can install your application and consent to sharing certain information with
your application. For example, if you wanted to build an application that integrated a business'
transaction history with an accounting system, you would use OAuth authentication.

Learn more