> ## 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.

# Platform API - Authentication

Our Platform API uses Bearer tokens to authenticate requests, there are two 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-...`).

<Note>Please note that unlike [Run API - Authentication](/run-api/authentication), `Provider Tokens` are not supported in `Platform API`, to perform any API requests we recommend setting up **API Key**.</Note>

<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.

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

<CodeGroup>
  ```curl CURL theme={null}
  curl -X GET "https://api.revong.com/api/v1/me/time" \
  -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://api.revong.com/api/v1/me/time', {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://api.revong.com/api/v1/me/time', 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://api.revong.com/api/v1/me/time", 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://api.revong.com/api/v1/me/time");
  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://api.revong.com/api/v1/me/time");
      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://api.revong.com/api/v1/me/time?token=sk-...&instance=instance_shortId_or_id"
  ```

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

  const fetchTime = async () => {
  const url = 'https://api.revong.com/api/v1/me/time';
  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://api.revong.com/api/v1/me/time', 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://api.revong.com/api/v1/me/time?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://api.revong.com/api/v1/me/time?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://api.revong.com/api/v1/me/time?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.
