> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run API - Authentication

Our Run API uses Bearer tokens to authenticate requests, there are three types of these tokens:

* `Platform Token` generated by our built-in platform auth provider (including [SSO/SAML](/authentication/sso-saml)).
* `API Key` generated by user, bound to `User` or `Service Account` (starts with `sk-...`).
* `Provider Token` generated by user's configured external providers e.g.: [Firebase](/authentication/providers#firebase).

<Card title="API Keys" icon="key" href="/authentication/api-keys">
  View the API Keys Documentation page
</Card>

<Tip>While making request, you must also pass instance identifier of your instance.</Tip>

There are two ways of passing token and **instance identifier** to the request.

<Note>These examples show only `GET` method but you can set any of following methods: `GET`, `POST`, `PUT`, `PATCH`, `DELETE` during Endpoint creation.</Note>

* `Headers` - preferred option to pass your tokens.

<CodeGroup>
  ```curl CURL theme={null}
  curl -X GET "https://run.revong.com/{YOUR_PATH}" \
  -H "Authorization: Bearer sk-..." \
  -H "Instance: instance_shortId_or_id"
  ```

  ```javascript NodeJS theme={null}
  import * as axios from 'axios';

  const fetchTime = async () => {
  const headers = {
  'Authorization': 'Bearer sk-...',
  'Instance': 'instance_shortId_or_id'
  };

  try {
  const response = await axios.get('https://run.revong.com/{YOUR_PATH}', {headers});
  console.log(response.data);
  } catch (error) {
  console.error('Error fetching time:', error);
  }
  };

  fetchTime();
  ```

  ```python Python theme={null}
  import requests

  headers = {
  'Authorization': 'Bearer sk-...',
  'Instance': 'instance_shortId_or_id'
  }

  try:
  response = requests.get('https://run.revong.com/{YOUR_PATH}', headers=headers)
  response.raise_for_status()
  print(response.json())
  except requests.exceptions.RequestException as e:
  print(f'Error fetching time: {e}')
  ```

  ```go Go theme={null}
  package main

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

  func main() {
  client := &http.Client{}

  req, err := http.NewRequest("GET", "https://run.revong.com/{YOUR_PATH}", nil)
  if err != nil {
  fmt.Println("Error creating request:", err)
  return
  }

  req.Header.Add("Authorization", "Bearer sk-...")
  req.Header.Add("Instance", "instance_shortId_or_id")

  resp, err := client.Do(req)
  if err != nil {
  fmt.Println("Error sending request:", err)
  return
  }

  defer resp.Body.Close()

  body, err := ioutil.ReadAll(resp.Body)
  if err != nil {
  fmt.Println("Error reading response:", err)
  return
  }

  fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class FetchTime {
  public static void main(String[] args) {
  try {
  URL url = new URL("https://run.revong.com/{YOUR_PATH}");
  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  connection.setRequestMethod("GET");
  connection.setRequestProperty("Authorization", "Bearer sk-...");
  connection.setRequestProperty("Instance", "instance_shortId_or_id");

  BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  String inputLine;
  StringBuilder content = new StringBuilder();
  while ((inputLine = in.readLine()) != null) {
  content.append(inputLine);
  }
  in.close();
  connection.disconnect();
  System.out.println(content.toString());
  } catch (Exception e) {
  e.printStackTrace();
  System.out.println("Error fetching time.");
  }
  }
  }
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main()
  {
      var client = new HttpClient();
      client.DefaultRequestHeaders.Add("Authorization", "Bearer sk-...");
      client.DefaultRequestHeaders.Add("Instance", "instance_shortId_or_id");

      try
  {
      var response = await client.GetAsync("https://run.revong.com/{YOUR_PATH}");
      response.EnsureSuccessStatusCode();
      var content = await response.Content.ReadAsStringAsync();
      Console.WriteLine(content);
  }
      catch (HttpRequestException e)
  {
      Console.WriteLine("Error fetching time: " + e.Message);
  }
  }
  }
  ```
</CodeGroup>

* `Query parameter` - optionally you can use query parameters (but we don't recommend it).

<CodeGroup>
  ```curl CURL theme={null}
  curl "https://run.revong.com/{YOUR_PATH}?token=sk-...&instance=instance_shortId_or_id"
  ```

  ```javascript NodeJS theme={null}
  const axios = require('axios');

  const fetchTime = async () => {
  const url = 'https://run.revong.com/{YOUR_PATH}';
  const params = {
  token: 'sk-...',
  instance: 'instance_shortId_or_id'
  };

  try {
  const response = await axios.get(url, {params});
  console.log(response.data);
  } catch (error) {
  console.error('Error fetching time:', error);
  }
  };

  fetchTime();
  ```

  ```python Python theme={null}
  import requests

  params = {
  'token': 'Bearer sk-...',
  'instance': 'instance_shortId_or_id'
  }

  try:
  response = requests.get('https://run.revong.com/{YOUR_PATH}', params=params)
  response.raise_for_status()
  print(response.json())
  except requests.exceptions.RequestException as e:
  print(f'Error fetching time: {e}')
  ```

  ```go Go theme={null}
  package main

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

  func main() {
  client := &http.Client{}
  url := "https://run.revong.com/{YOUR_PATH}?token=sk-...&instance=instance_shortId_or_id"

  req, err := http.NewRequest("GET", url, nil)
  if err != nil {
  fmt.Println("Error creating request:", err)
  return
  }

  resp, err := client.Do(req)
  if err != nil {
  fmt.Println("Error sending request:", err)
  return
  }
  defer resp.Body.Close()

  body, err := ioutil.ReadAll(resp.Body)
  if err != nil {
  fmt.Println("Error reading response:", err)
  return
  }

  fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}

  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class FetchTime {
  public static void main(String[] args) {
  try {
  URL url = new URL("https://run.revong.com/{YOUR_PATH}?token=sk-...&instance=instance_shortId_or_id");
  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  connection.setRequestMethod("GET");

  BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  String inputLine;
  StringBuilder content = new StringBuilder();
  while ((inputLine = in.readLine()) != null) {
  content.append(inputLine);
  }
  in.close();
  connection.disconnect();
  System.out.println(content.toString());
  } catch (Exception e) {
  e.printStackTrace();
  System.out.println("Error fetching time.");
  }
  }
  }
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main()
  {
      var client = new HttpClient();
      string url = "https://run.revong.com/{YOUR_PATH}?token=sk-...&instance=instance_shortId_or_id";

      try
  {
      var response = await client.GetAsync(url);
      response.EnsureSuccessStatusCode();
      var content = await response.Content.ReadAsStringAsync();
      Console.WriteLine(content);
  }
      catch (HttpRequestException e)
  {
      Console.WriteLine("Error fetching time: " + e.Message);
  }
  }
  }
  ```
</CodeGroup>

You can also combine these both were you feel comfortable with, keep in mind that we **don't** consider 'instanceId' as being a secret.
