# Introducción

{% hint style="info" %}
Para empezar a usar la API debes crear una cuenta en [www.simplefact.pe](https://simplefact.pe/) y obtener tu **TOKEN**.
{% endhint %}

### Endpoint

La URL Base de la API es el subdominio de tu empresa adicionado **`api/v1`** ejemplo:

```http
https://tunegocio.simplefact.pe/api/v1
```

### Autenticación

Para autenticar las solicitudes solo es necesario añadir una cabecera con Authorization a cada solicitud HTTP `Authorization Bearer Token` ejemplo de HTTP REQUEST:

```http
POST /api/v1 HTTP/1.1
Host: tunegocio.simplefact.pe
Authorization: Bearer b00131b17becc9906f5081793e79a5d74a7ab6cb007818be1e0628fdef7c8
```

Ejemplos según lenguaje de programación:

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

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://demo.simplefact.pe/api/v1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Authorization: Bearer b00131b17becc9906f5081793e79a5d74a7ab6cb007818be1e0628fdef7c8fe2",
    "Content-Type: application/json"
  ),
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}

{% tab title="JAVA" %}

```java
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
  .url("https://demo.simplefact.pe/api/v1")
  .post(null)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer b00131b17becc9906f5081793e79a5d74a7ab6cb007818be1e0628fdef7c8fe2")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Python" %}

```python

url = "https://demo.simplefact.pe/api/v1"

payload = ""
headers = {
    'Accept': "application/json",
    'Authorization': "Bearer b00131b17becc9906f5081793e79a5d74a7ab6cb007818be1e0628fdef7c8fe2",
    'Content-Type': "application/json"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="C#" %}

```csharp
var client = new RestClient("https://demo.simplefact.pe/api/v1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer b00131b17becc9906f5081793e79a5d74a7ab6cb007818be1e0628fdef7c8fe2");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);
```

{% endtab %}
{% endtabs %}


---

# 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://docs.simplefact.pe/api/introduccion.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.
