openapi: 3.0.3
servers:
  - url: https://api.verifacti.com/
info:
  title: SII API documentation
  contact:
    email: info@verifacti.com
    name: Contact
    url: https://www.verifacti.com
  description: |

    &nbsp;

    Here you will find the technical documentation for our API to submit the issued-invoices book to the Agencia Estatal de Administración Tributaria (AEAT)
    in accordance with the Suministro Inmediato de Información (SII, immediate supply of information).

    &nbsp;

    We also have APIs to comply with the Verifactu and TicketBai requirements, the equivalent of Verifactu in the Basque Country. They are
    separate APIs but with an analogous structure. Their documentation can be found <a href="https://www.verifacti.com/en/docs">here</a> and <a href="https://www.verifacti.com/en/tb-docs">here</a>.

    &nbsp;

    Additionally, we have created an API to manage different tax IDs (NIFs) programmatically. For users who only need to manage
    a few NIFs, this can be done conveniently through our interface. However, sometimes this is not practical and a
    programmatic way to register and deregister different NIFs is needed. For this, you can use our NIF management API, whose documentation can
    be found <a href="https://www.verifacti.com/en/nifs-docs">here</a>. This API is included in the price and can be used by any user
    with an active subscription.

    # Comparison between the AEAT API and the Verifacti API

    The web service that the Agencia Estatal de Administración Tributaria (AEAT) provides to taxpayers for the SII
    requires the following steps:

    &nbsp;

    <ol style="list-style: decimal;">
      <li>Build an XML file with the invoice records, following the SII schemas.</li>
      <li>Group the invoices into submissions of up to 10,000 records, since the AEAT asks for them not to be sent one by one.</li>
      <li>Send that XML file to the AEAT through an authenticated call using a recognised qualified electronic certificate.</li>
      <li>Review the response for each record and send the rejected ones again, within 4 working days of the invoice's issue.</li>
      <li>Store the submissions and their responses.</li>
    </ol>

    &nbsp;

    Using our SII API, all these steps are reduced to a single one:

    &nbsp;

    <ol style="list-style: decimal;">
      <li>Make a call (without a certificate) with the invoice data in JSON format.</li>
    </ol>

    &nbsp;

    We take care of the XML files, grouping the invoices into submissions, the authenticated call, the AEAT's responses and
    storing the submissions.

    &nbsp;

    At any time you can check the status of all your submissions and invoices via the API. You will also have a simple dashboard
    to do it more conveniently. This can be especially useful during your first tests and integration. There
    you will also find examples of the different calls and even a terminal so you can test without needing to use
    POSTMAN, for example.

    # Basic operation

    The AEAT has a test environment and a production environment for the SII.
    The Verifacti API has, in the same way, a test environment and a production environment.
    Therefore, in both cases, the Verifacti API communicates with the AEAT in the corresponding environment to make the submissions.

    &nbsp;

    When you register a NIF with the <code>sii</code> tax authority in our dashboard, an API key (test or production) is generated, which you must include in the
    <code>Authorization</code> header of every call. This way, the NIF of the book's owner and the environment are determined by the API key being used.

    &nbsp;

    To register an invoice, call the POST <code>/sii/create</code> endpoint with the invoice data in the body of the call, in JSON format.
    The response to that call is a unique identifier to check the status of the record.
    To register several invoices in a single call, up to 500, use POST <code>/sii/create_bulk</code>.

    &nbsp;

    Because the SII asks for invoices to be grouped, the record is queued and sent to the AEAT together with the NIF's other pending records.
    Each NIF makes at most one submission every 6 minutes: if it hasn't submitted anything recently, the record goes out the next minute.
    When the AEAT answers, the record's status is updated in our system; you can check it at any time or receive it through webhooks.

    Modification and cancellation records follow the same queuing process.

    &nbsp;

    If the AEAT rejects an invoice (status <code>Incorrecto</code>), the invoice is not registered: fix the data and send it again with POST
    <code>/sii/create</code>. If it accepts it with errors (status <code>Aceptado con errores</code>), correct it with PUT <code>/sii/modify</code>.

    &nbsp;

    Data in the test environment is kept for at most 90 days.

    # Idempotency

    The mutating endpoints (<code>/create</code>, <code>/modify</code> and <code>/cancel</code>) accept an optional
    <code>Idempotency-Key</code> header for safe retries after network failures. The key is a printable
    ASCII string of 1 to 255 characters and is remembered for 24 hours per NIF. Full details and error codes (<code>400</code>, <code>409</code>, <code>422</code>) are documented in
    each affected endpoint.

    How it behaves:

    <ul style="list-style: disc;">
      <li><strong>What is replayed.</strong> A retry with the same key and exactly the same body returns the status and body of the first response, with the <code>Idempotent-Replayed: true</code> header, without creating a new record.</li>
      <li><strong>Which responses are stored.</strong> <code>2xx</code> and <code>4xx</code>, which are final outcomes: a <code>400</code> is replayed too, so if you fix the data use a new key. <code>5xx</code> are not stored: the retry is processed again and all the data is validated again, <code>fecha_expedicion</code> included.</li>
      <li><strong>How long it lasts.</strong> 24 hours from when the first response is stored. Retries don't extend it; after that the key is forgotten and the request is processed as new.</li>
      <li><strong>What it is bound to.</strong> The owner's NIF, not the API key, so it survives a key rotation. A request rejected at authentication (<code>401</code> or <code>403</code>) never uses the key.</li>
      <li><strong>If the first request is still in progress</strong>, the retry gets <code>409</code>: wait a few seconds and retry.</li>
      <li><strong>If more than 24 hours have passed</strong> and you don't have the response, check with <code>POST /sii/list</code> (<code>ejercicio</code> and <code>periodo</code>) whether the invoice was registered before sending it again.</li>
    </ul>
paths:
  /sii/health:
    get:
      summary: API status
      description: "Returns the API key status: use it to check that the API is up and which NIF, environment and tax authority it belongs to."
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl 'https://api.verifacti.com/sii/health' \
            --header 'Authorization: Bearer <API_KEY>'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/health'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            response = requests.get(url, headers=headers)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/health';
            const headers = {
              'Authorization': 'Bearer <API_KEY>'
            };
            fetch(url, { headers })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const response = await axios.get("https://api.verifacti.com/sii/health", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              },
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/health";

            $headers = [
                "Authorization: Bearer <API_KEY>",
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, err := http.NewRequest(\"GET\", \"https://api.verifacti.com/sii/health\", nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/health"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .GET()
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var response = await client.GetAsync("https://api.verifacti.com/sii/health");

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/health"

            oHttp.Open "GET", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"

            oHttp.send

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      responses:
        "200":
          description: API status
          content:
            application/json:
              schema:
                type: object
                properties:
                  estado:
                    description: API status.
                    type: string
                    example: OK
                  nif:
                    description: Owner's NIF.
                    type: string
                    example: B12345678
                  entorno:
                    description: API key environment.
                    type: string
                    enum:
                      - test
                      - prod
                    example: test
                  hacienda:
                    description: NIF's tax authority.
                    type: string
                    example: sii
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
  /sii/status:
    get:
      summary: Record status
      description: Returns the status of a record (registration, modification or cancellation) from the <code>uuid</code> returned when it was created. In the test environment records are kept for at most 90 days.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl 'https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562' \
            --header 'Authorization: Bearer <API_KEY>'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            response = requests.get(url, headers=headers)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562';
            const headers = {
              'Authorization': 'Bearer <API_KEY>'
            };
            fetch(url, { headers })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const response = await axios.get("https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              },
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562";

            $headers = [
                "Authorization: Bearer <API_KEY>",
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, err := http.NewRequest(\"GET\", \"https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562\", nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .GET()
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var response = await client.GetAsync("https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562");

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/status?uuid=ea6eae92-bac6-48c3-baa4-2bbf6b5ee562"

            oHttp.Open "GET", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"

            oHttp.send

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      parameters:
        - in: query
          name: uuid
          required: true
          description: Record uuid.
          schema:
            type: string
            example: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
      responses:
        "200":
          description: Record status
          content:
            application/json:
              schema:
                type: object
                properties:
                  nif:
                    type: string
                    description: Owner's NIF.
                    example: B12345678
                  serie:
                    type: string
                    description: Invoice series.
                    example: A
                  numero:
                    type: string
                    description: Invoice number.
                    example: "1"
                  fecha_expedicion:
                    type: string
                    description: Issue date.
                    example: CURRENT_DATE
                  operacion:
                    type: string
                    enum:
                      - Alta
                      - Modificación
                      - Baja
                    description: Record operation.
                    example: Alta
                  estado:
                    type: string
                    enum:
                      - Pendiente
                      - Correcto
                      - Aceptado con errores
                      - Incorrecto
                      - Duplicado
                      - Anulado
                      - Factura inexistente
                      - No registrado
                    description: "Record status:<ul style=\"list-style: disc;\"><li><code>Pendiente</code>: queued, not yet sent to the AEAT.</li><li><code>Correcto</code>: registered by the AEAT.</li><li><code>Aceptado con errores</code>: registered by the AEAT with errors (see <code>codigo_error</code> and <code>mensaje_error</code>). Correct it with <code>/sii/modify</code>.</li><li><code>Incorrecto</code>: rejected by the AEAT. It is not registered: fix the data and send it again with <code>/sii/create</code>.</li><li><code>Duplicado</code>: the AEAT already had this invoice (same series, number and date). Its state in the book is in <code>estado_registro_duplicado</code>.</li><li><code>Anulado</code>: cancellation registered by the AEAT.</li><li><code>Factura inexistente</code>: cancellation of an invoice the AEAT does not have registered.</li><li><code>No registrado</code>: the AEAT rejected the whole submission without registering anything (for example, because of an error in the header). Send it again with <code>/sii/create</code>.</li></ul>"
                    example: Correcto
                  codigo_error:
                    type: string
                    nullable: true
                    description: AEAT error code, if any.
                    example: null
                  mensaje_error:
                    type: string
                    nullable: true
                    description: AEAT error description, if any.
                    example: null
                  estado_registro_duplicado:
                    type: string
                    nullable: true
                    enum:
                      - Correcta
                      - AceptadaConErrores
                      - Anulada
                      - null
                    description: "Only in <code>Duplicado</code>: state of the invoice the AEAT already had."
                    example: null
        "400":
          description: The uuid is missing.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "404":
          description: There is no record with that uuid for this NIF.
  /sii/create:
    post:
      summary: Create new invoice
      description: |-
        Creates the registration record (A0) of an issued invoice in the issued-invoices book. Responses:
        <ul style="list-style: disc;">
          <li><strong>200</strong>: the invoice is valid and queued with the status <code>Pendiente</code>. It is sent to the AEAT in the NIF's next submission. Our acceptance does not guarantee the AEAT's: check the result with <code>GET /sii/status</code> using the <code>uuid</code>, or receive it in your webhooks (documentation <a href='https://www.verifacti.com/en/nifs-docs#tag/Webhooks' target='_blank'>here</a>).</li>
          <li><strong>400</strong>: error in the JSON. The record is not created and nothing is sent. The message is in <code>error</code> and a stable identifier in <code>codigo</code>. The checks go from required fields to the AEAT's rules and the check that the counterparty is in the census.</li>
          <li><strong>500</strong>: server error. The record is not created; retry later.</li>
        </ul>

        The AEAT's SII validations and errors can be found <a href='https://sede.agenciatributaria.gob.es/Sede/iva/suministro-inmediato-informacion/informacion-tecnica/documento-validaciones-errores.html' target='_blank'>here</a>.

        &nbsp;

        This endpoint also accepts an optional `Idempotency-Key` header. If included, retries of the same logical request with the same key replay the original response (including the `Idempotent-Replayed: true` response header and the echoed `Idempotency-Key`). Keys are bound to the NIF and remembered for 24 hours. Reusing the same key with a different body returns 422; a concurrent retry while the first one is still in progress returns 409. See the "Idempotency" section at the start of this documentation for details.
      x-codeSamples:
        - lang: cURL
          label: cURL — Standard invoice
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Standard invoice
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Standard invoice
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Standard invoice
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Standard invoice
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Standard invoice
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura normal\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Standard invoice
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura normal",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Standard invoice
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura normal"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Standard invoice
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura normal""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Simplified invoice
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura simplificada",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Simplified invoice
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura simplificada",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Simplified invoice
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura simplificada",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Simplified invoice
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura simplificada",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Simplified invoice
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura simplificada",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Simplified invoice
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F2\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura simplificada\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Simplified invoice
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F2",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura simplificada",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Simplified invoice
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F2"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura simplificada"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Simplified invoice
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F2""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura simplificada""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Multiple VAT rates
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con múltiples IVAs",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    },
                    {
                      "tipo_impositivo": "10",
                      "base_imponible": "100",
                      "cuota_repercutida": "10"
                    },
                    {
                      "tipo_impositivo": "4",
                      "base_imponible": "50",
                      "cuota_repercutida": "2"
                    }
                  ]
                }
              },
              "importe_total": "404"
            }'
        - lang: Python
          label: Python — Multiple VAT rates
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con múltiples IVAs",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    },
                    {
                      "tipo_impositivo": "10",
                      "base_imponible": "100",
                      "cuota_repercutida": "10"
                    },
                    {
                      "tipo_impositivo": "4",
                      "base_imponible": "50",
                      "cuota_repercutida": "2"
                    }
                  ]
                }
              },
              "importe_total": "404"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Multiple VAT rates
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con múltiples IVAs",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    },
                    {
                      "tipo_impositivo": "10",
                      "base_imponible": "100",
                      "cuota_repercutida": "10"
                    },
                    {
                      "tipo_impositivo": "4",
                      "base_imponible": "50",
                      "cuota_repercutida": "2"
                    }
                  ]
                }
              },
              "importe_total": "404"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Multiple VAT rates
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con múltiples IVAs",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    },
                    {
                      "tipo_impositivo": "10",
                      "base_imponible": "100",
                      "cuota_repercutida": "10"
                    },
                    {
                      "tipo_impositivo": "4",
                      "base_imponible": "50",
                      "cuota_repercutida": "2"
                    }
                  ]
                }
              },
              "importe_total": "404"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Multiple VAT rates
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con múltiples IVAs",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    },
                    {
                      "tipo_impositivo": "10",
                      "base_imponible": "100",
                      "cuota_repercutida": "10"
                    },
                    {
                      "tipo_impositivo": "4",
                      "base_imponible": "50",
                      "cuota_repercutida": "2"
                    }
                  ]
                }
              },
              "importe_total": "404"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Multiple VAT rates
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura con múltiples IVAs\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        },\n        {\n          \"tipo_impositivo\": \"10\",\n          \"base_imponible\": \"100\",\n          \"cuota_repercutida\": \"10\"\n        },\n        {\n          \"tipo_impositivo\": \"4\",\n          \"base_imponible\": \"50\",\n          \"cuota_repercutida\": \"2\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"404\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Multiple VAT rates
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura con múltiples IVAs",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    },
                                    {
                                      "tipo_impositivo": "10",
                                      "base_imponible": "100",
                                      "cuota_repercutida": "10"
                                    },
                                    {
                                      "tipo_impositivo": "4",
                                      "base_imponible": "50",
                                      "cuota_repercutida": "2"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "404"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Multiple VAT rates
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura con múltiples IVAs"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    },
                    {
                      ""tipo_impositivo"": ""10"",
                      ""base_imponible"": ""100"",
                      ""cuota_repercutida"": ""10""
                    },
                    {
                      ""tipo_impositivo"": ""4"",
                      ""base_imponible"": ""50"",
                      ""cuota_repercutida"": ""2""
                    }
                  ]
                }
              },
              ""importe_total"": ""404""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Multiple VAT rates
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura con múltiples IVAs""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }," & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""10""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""100""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""10""" & vbCrLf
            sBody = sBody & "        }," & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""4""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""50""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""2""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""404""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Intra-EU B2B - Sale of goods
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E5",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — Intra-EU B2B - Sale of goods
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E5",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Intra-EU B2B - Sale of goods
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E5",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Intra-EU B2B - Sale of goods
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E5",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Intra-EU B2B - Sale of goods
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E5",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Intra-EU B2B - Sale of goods
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura B2B intracomunitaria - Venta de bienes\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"id_type\": \"02\",\n    \"id\": \"BE0404621642\"\n  },\n  \"desglose\": {\n    \"entrega\": {\n      \"exenta\": [\n        {\n          \"causa_exencion\": \"E5\",\n          \"base_imponible\": \"200\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Intra-EU B2B - Sale of goods
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "id_type": "02",
                                "id": "BE0404621642"
                              },
                              "desglose": {
                                "entrega": {
                                  "exenta": [
                                    {
                                      "causa_exencion": "E5",
                                      "base_imponible": "200"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Intra-EU B2B - Sale of goods
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura B2B intracomunitaria - Venta de bienes"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""id_type"": ""02"",
                ""id"": ""BE0404621642""
              },
              ""desglose"": {
                ""entrega"": {
                  ""exenta"": [
                    {
                      ""causa_exencion"": ""E5"",
                      ""base_imponible"": ""200""
                    }
                  ]
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Intra-EU B2B - Sale of goods
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura B2B intracomunitaria - Venta de bienes""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""id_type"": ""02""," & vbCrLf
            sBody = sBody & "    ""id"": ""BE0404621642""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""entrega"": {" & vbCrLf
            sBody = sBody & "      ""exenta"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""causa_exencion"": ""E5""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Intra-EU B2B - Provision of services
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — Intra-EU B2B - Provision of services
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Intra-EU B2B - Provision of services
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Intra-EU B2B - Provision of services
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Intra-EU B2B - Provision of services
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "id_type": "02",
                "id": "BE0404621642"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Intra-EU B2B - Provision of services
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura B2B intracomunitaria - Prestación de servicios\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"id_type\": \"02\",\n    \"id\": \"BE0404621642\"\n  },\n  \"desglose\": {\n    \"prestacion_servicios\": {\n      \"no_sujeta\": {\n        \"importe_tai_reglas_localizacion\": \"200\"\n      }\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Intra-EU B2B - Provision of services
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura B2B intracomunitaria - Prestación de servicios",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "id_type": "02",
                                "id": "BE0404621642"
                              },
                              "desglose": {
                                "prestacion_servicios": {
                                  "no_sujeta": {
                                    "importe_tai_reglas_localizacion": "200"
                                  }
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Intra-EU B2B - Provision of services
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura B2B intracomunitaria - Prestación de servicios"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""id_type"": ""02"",
                ""id"": ""BE0404621642""
              },
              ""desglose"": {
                ""prestacion_servicios"": {
                  ""no_sujeta"": {
                    ""importe_tai_reglas_localizacion"": ""200""
                  }
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Intra-EU B2B - Provision of services
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura B2B intracomunitaria - Prestación de servicios""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""id_type"": ""02""," & vbCrLf
            sBody = sBody & "    ""id"": ""BE0404621642""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""prestacion_servicios"": {" & vbCrLf
            sBody = sBody & "      ""no_sujeta"": {" & vbCrLf
            sBody = sBody & "        ""importe_tai_reglas_localizacion"": ""200""" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Intra-EU B2C - Below the threshold
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Intra-EU B2C - Below the threshold
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                }
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Intra-EU B2C - Below the threshold
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Intra-EU B2C - Below the threshold
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                }
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Intra-EU B2C - Below the threshold
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Intra-EU B2C - Below the threshold
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura B2C intracomunitaria - Por debajo del umbral\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"codigo_pais\": \"DE\",\n    \"id_type\": \"03\",\n    \"id\": \"F8624KW3J6\"\n  },\n  \"desglose\": {\n    \"entrega\": {\n      \"no_exenta\": {\n        \"tipo_no_exenta\": \"S1\",\n        \"detalle_iva\": [\n          {\n            \"tipo_impositivo\": \"21\",\n            \"base_imponible\": \"200\",\n            \"cuota_repercutida\": \"42\"\n          }\n        ]\n      }\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Intra-EU B2C - Below the threshold
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura B2C intracomunitaria - Por debajo del umbral",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "codigo_pais": "DE",
                                "id_type": "03",
                                "id": "F8624KW3J6"
                              },
                              "desglose": {
                                "entrega": {
                                  "no_exenta": {
                                    "tipo_no_exenta": "S1",
                                    "detalle_iva": [
                                      {
                                        "tipo_impositivo": "21",
                                        "base_imponible": "200",
                                        "cuota_repercutida": "42"
                                      }
                                    ]
                                  }
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Intra-EU B2C - Below the threshold
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura B2C intracomunitaria - Por debajo del umbral"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""codigo_pais"": ""DE"",
                ""id_type"": ""03"",
                ""id"": ""F8624KW3J6""
              },
              ""desglose"": {
                ""entrega"": {
                  ""no_exenta"": {
                    ""tipo_no_exenta"": ""S1"",
                    ""detalle_iva"": [
                      {
                        ""tipo_impositivo"": ""21"",
                        ""base_imponible"": ""200"",
                        ""cuota_repercutida"": ""42""
                      }
                    ]
                  }
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Intra-EU B2C - Below the threshold
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura B2C intracomunitaria - Por debajo del umbral""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""codigo_pais"": ""DE""," & vbCrLf
            sBody = sBody & "    ""id_type"": ""03""," & vbCrLf
            sBody = sBody & "    ""id"": ""F8624KW3J6""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""entrega"": {" & vbCrLf
            sBody = sBody & "      ""no_exenta"": {" & vbCrLf
            sBody = sBody & "        ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "        ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "          {" & vbCrLf
            sBody = sBody & "            ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "            ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "            ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "          }" & vbCrLf
            sBody = sBody & "        ]" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Intra-EU B2C - OSS
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "17"
              ],
              "descripcion": "Factura B2C intracomunitaria - OSS",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — Intra-EU B2C - OSS
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "17"
              ],
              "descripcion": "Factura B2C intracomunitaria - OSS",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Intra-EU B2C - OSS
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "17"
              ],
              "descripcion": "Factura B2C intracomunitaria - OSS",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Intra-EU B2C - OSS
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "17"
              ],
              "descripcion": "Factura B2C intracomunitaria - OSS",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Intra-EU B2C - OSS
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "17"
              ],
              "descripcion": "Factura B2C intracomunitaria - OSS",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "desglose": {
                "entrega": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Intra-EU B2C - OSS
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"17\"\n  ],\n  \"descripcion\": \"Factura B2C intracomunitaria - OSS\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"codigo_pais\": \"DE\",\n    \"id_type\": \"03\",\n    \"id\": \"F8624KW3J6\"\n  },\n  \"desglose\": {\n    \"entrega\": {\n      \"no_sujeta\": {\n        \"importe_tai_reglas_localizacion\": \"200\"\n      }\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Intra-EU B2C - OSS
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "17"
                              ],
                              "descripcion": "Factura B2C intracomunitaria - OSS",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "codigo_pais": "DE",
                                "id_type": "03",
                                "id": "F8624KW3J6"
                              },
                              "desglose": {
                                "entrega": {
                                  "no_sujeta": {
                                    "importe_tai_reglas_localizacion": "200"
                                  }
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Intra-EU B2C - OSS
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""17""
              ],
              ""descripcion"": ""Factura B2C intracomunitaria - OSS"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""codigo_pais"": ""DE"",
                ""id_type"": ""03"",
                ""id"": ""F8624KW3J6""
              },
              ""desglose"": {
                ""entrega"": {
                  ""no_sujeta"": {
                    ""importe_tai_reglas_localizacion"": ""200""
                  }
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Intra-EU B2C - OSS
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""17""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura B2C intracomunitaria - OSS""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""codigo_pais"": ""DE""," & vbCrLf
            sBody = sBody & "    ""id_type"": ""03""," & vbCrLf
            sBody = sBody & "    ""id"": ""F8624KW3J6""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""entrega"": {" & vbCrLf
            sBody = sBody & "      ""no_sujeta"": {" & vbCrLf
            sBody = sBody & "        ""importe_tai_reglas_localizacion"": ""200""" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: "cURL — Outside the EU: Export of goods"
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "02"
              ],
              "descripcion": "Factura extracomunitaria - Exportación de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E2",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: "Python — Outside the EU: Export of goods"
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "02"
              ],
              "descripcion": "Factura extracomunitaria - Exportación de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E2",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: "JavaScript — Outside the EU: Export of goods"
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "02"
              ],
              "descripcion": "Factura extracomunitaria - Exportación de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E2",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: "Node.js — Outside the EU: Export of goods"
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "02"
              ],
              "descripcion": "Factura extracomunitaria - Exportación de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E2",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: "PHP — Outside the EU: Export of goods"
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "02"
              ],
              "descripcion": "Factura extracomunitaria - Exportación de bienes",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "entrega": {
                  "exenta": [
                    {
                      "causa_exencion": "E2",
                      "base_imponible": "200"
                    }
                  ]
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: "Go — Outside the EU: Export of goods"
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"02\"\n  ],\n  \"descripcion\": \"Factura extracomunitaria - Exportación de bienes\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"codigo_pais\": \"US\",\n    \"id_type\": \"03\",\n    \"id\": \"M76543210\"\n  },\n  \"desglose\": {\n    \"entrega\": {\n      \"exenta\": [\n        {\n          \"causa_exencion\": \"E2\",\n          \"base_imponible\": \"200\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: "Java — Outside the EU: Export of goods"
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "02"
                              ],
                              "descripcion": "Factura extracomunitaria - Exportación de bienes",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "codigo_pais": "US",
                                "id_type": "03",
                                "id": "M76543210"
                              },
                              "desglose": {
                                "entrega": {
                                  "exenta": [
                                    {
                                      "causa_exencion": "E2",
                                      "base_imponible": "200"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: "C# — Outside the EU: Export of goods"
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""02""
              ],
              ""descripcion"": ""Factura extracomunitaria - Exportación de bienes"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""codigo_pais"": ""US"",
                ""id_type"": ""03"",
                ""id"": ""M76543210""
              },
              ""desglose"": {
                ""entrega"": {
                  ""exenta"": [
                    {
                      ""causa_exencion"": ""E2"",
                      ""base_imponible"": ""200""
                    }
                  ]
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: "VB6 — Outside the EU: Export of goods"
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""02""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura extracomunitaria - Exportación de bienes""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""codigo_pais"": ""US""," & vbCrLf
            sBody = sBody & "    ""id_type"": ""03""," & vbCrLf
            sBody = sBody & "    ""id"": ""M76543210""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""entrega"": {" & vbCrLf
            sBody = sBody & "      ""exenta"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""causa_exencion"": ""E2""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: "cURL — Outside the EU: Provision of services"
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura extracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: "Python — Outside the EU: Provision of services"
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura extracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: "JavaScript — Outside the EU: Provision of services"
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura extracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: "Node.js — Outside the EU: Provision of services"
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura extracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: "PHP — Outside the EU: Provision of services"
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura extracomunitaria - Prestación de servicios",
              "nombre": "Nombre destinatario",
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "desglose": {
                "prestacion_servicios": {
                  "no_sujeta": {
                    "importe_tai_reglas_localizacion": "200"
                  }
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: "Go — Outside the EU: Provision of services"
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura extracomunitaria - Prestación de servicios\",\n  \"nombre\": \"Nombre destinatario\",\n  \"id_otro\": {\n    \"codigo_pais\": \"US\",\n    \"id_type\": \"03\",\n    \"id\": \"M76543210\"\n  },\n  \"desglose\": {\n    \"prestacion_servicios\": {\n      \"no_sujeta\": {\n        \"importe_tai_reglas_localizacion\": \"200\"\n      }\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: "Java — Outside the EU: Provision of services"
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura extracomunitaria - Prestación de servicios",
                              "nombre": "Nombre destinatario",
                              "id_otro": {
                                "codigo_pais": "US",
                                "id_type": "03",
                                "id": "M76543210"
                              },
                              "desglose": {
                                "prestacion_servicios": {
                                  "no_sujeta": {
                                    "importe_tai_reglas_localizacion": "200"
                                  }
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: "C# — Outside the EU: Provision of services"
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura extracomunitaria - Prestación de servicios"",
              ""nombre"": ""Nombre destinatario"",
              ""id_otro"": {
                ""codigo_pais"": ""US"",
                ""id_type"": ""03"",
                ""id"": ""M76543210""
              },
              ""desglose"": {
                ""prestacion_servicios"": {
                  ""no_sujeta"": {
                    ""importe_tai_reglas_localizacion"": ""200""
                  }
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: "VB6 — Outside the EU: Provision of services"
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura extracomunitaria - Prestación de servicios""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "  ""id_otro"": {" & vbCrLf
            sBody = sBody & "    ""codigo_pais"": ""US""," & vbCrLf
            sBody = sBody & "    ""id_type"": ""03""," & vbCrLf
            sBody = sBody & "    ""id"": ""M76543210""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""prestacion_servicios"": {" & vbCrLf
            sBody = sBody & "      ""no_sujeta"": {" & vbCrLf
            sBody = sBody & "        ""importe_tai_reglas_localizacion"": ""200""" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — VAT-exempt
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura exenta de IVA",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "exenta": [
                  {
                    "causa_exencion": "E1",
                    "base_imponible": "200"
                  }
                ]
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — VAT-exempt
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura exenta de IVA",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "exenta": [
                  {
                    "causa_exencion": "E1",
                    "base_imponible": "200"
                  }
                ]
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — VAT-exempt
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura exenta de IVA",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "exenta": [
                  {
                    "causa_exencion": "E1",
                    "base_imponible": "200"
                  }
                ]
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — VAT-exempt
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura exenta de IVA",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "exenta": [
                  {
                    "causa_exencion": "E1",
                    "base_imponible": "200"
                  }
                ]
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — VAT-exempt
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura exenta de IVA",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "exenta": [
                  {
                    "causa_exencion": "E1",
                    "base_imponible": "200"
                  }
                ]
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — VAT-exempt
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura exenta de IVA\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"exenta\": [\n      {\n        \"causa_exencion\": \"E1\",\n        \"base_imponible\": \"200\"\n      }\n    ]\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — VAT-exempt
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura exenta de IVA",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "exenta": [
                                  {
                                    "causa_exencion": "E1",
                                    "base_imponible": "200"
                                  }
                                ]
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — VAT-exempt
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura exenta de IVA"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""exenta"": [
                  {
                    ""causa_exencion"": ""E1"",
                    ""base_imponible"": ""200""
                  }
                ]
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — VAT-exempt
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura exenta de IVA""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""exenta"": [" & vbCrLf
            sBody = sBody & "      {" & vbCrLf
            sBody = sBody & "        ""causa_exencion"": ""E1""," & vbCrLf
            sBody = sBody & "        ""base_imponible"": ""200""" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    ]" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Transaction not subject to VAT
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Operación no sujeta",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_por_articulos_7_14_otros": "200"
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — Transaction not subject to VAT
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Operación no sujeta",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_por_articulos_7_14_otros": "200"
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Transaction not subject to VAT
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Operación no sujeta",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_por_articulos_7_14_otros": "200"
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Transaction not subject to VAT
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Operación no sujeta",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_por_articulos_7_14_otros": "200"
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Transaction not subject to VAT
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Operación no sujeta",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_por_articulos_7_14_otros": "200"
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Transaction not subject to VAT
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Operación no sujeta\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_sujeta\": {\n      \"importe_por_articulos_7_14_otros\": \"200\"\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Transaction not subject to VAT
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Operación no sujeta",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_sujeta": {
                                  "importe_por_articulos_7_14_otros": "200"
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Transaction not subject to VAT
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Operación no sujeta"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_sujeta"": {
                  ""importe_por_articulos_7_14_otros"": ""200""
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Transaction not subject to VAT
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Operación no sujeta""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_sujeta"": {" & vbCrLf
            sBody = sBody & "      ""importe_por_articulos_7_14_otros"": ""200""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Transaction subject to IGIC or IPSI
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "08"
              ],
              "descripcion": "Operación sujeta a IGIC (Canarias)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_tai_reglas_localizacion": "200"
                }
              },
              "importe_total": "200"
            }'
        - lang: Python
          label: Python — Transaction subject to IGIC or IPSI
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "08"
              ],
              "descripcion": "Operación sujeta a IGIC (Canarias)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_tai_reglas_localizacion": "200"
                }
              },
              "importe_total": "200"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Transaction subject to IGIC or IPSI
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "08"
              ],
              "descripcion": "Operación sujeta a IGIC (Canarias)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_tai_reglas_localizacion": "200"
                }
              },
              "importe_total": "200"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Transaction subject to IGIC or IPSI
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "08"
              ],
              "descripcion": "Operación sujeta a IGIC (Canarias)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_tai_reglas_localizacion": "200"
                }
              },
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Transaction subject to IGIC or IPSI
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "08"
              ],
              "descripcion": "Operación sujeta a IGIC (Canarias)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_sujeta": {
                  "importe_tai_reglas_localizacion": "200"
                }
              },
              "importe_total": "200"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Transaction subject to IGIC or IPSI
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"08\"\n  ],\n  \"descripcion\": \"Operación sujeta a IGIC (Canarias)\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_sujeta\": {\n      \"importe_tai_reglas_localizacion\": \"200\"\n    }\n  },\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Transaction subject to IGIC or IPSI
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "08"
                              ],
                              "descripcion": "Operación sujeta a IGIC (Canarias)",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_sujeta": {
                                  "importe_tai_reglas_localizacion": "200"
                                }
                              },
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Transaction subject to IGIC or IPSI
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""08""
              ],
              ""descripcion"": ""Operación sujeta a IGIC (Canarias)"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_sujeta"": {
                  ""importe_tai_reglas_localizacion"": ""200""
                }
              },
              ""importe_total"": ""200""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Transaction subject to IGIC or IPSI
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""08""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Operación sujeta a IGIC (Canarias)""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_sujeta"": {" & vbCrLf
            sBody = sBody & "      ""importe_tai_reglas_localizacion"": ""200""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Credit note
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de abono",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-200",
                      "cuota_repercutida": "-42"
                    }
                  ]
                }
              },
              "importe_total": "-242"
            }'
        - lang: Python
          label: Python — Credit note
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de abono",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-200",
                      "cuota_repercutida": "-42"
                    }
                  ]
                }
              },
              "importe_total": "-242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Credit note
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de abono",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-200",
                      "cuota_repercutida": "-42"
                    }
                  ]
                }
              },
              "importe_total": "-242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Credit note
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de abono",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-200",
                      "cuota_repercutida": "-42"
                    }
                  ]
                }
              },
              "importe_total": "-242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Credit note
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de abono",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-200",
                      "cuota_repercutida": "-42"
                    }
                  ]
                }
              },
              "importe_total": "-242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Credit note
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura de abono\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"-200\",\n          \"cuota_repercutida\": \"-42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"-242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Credit note
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura de abono",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "-200",
                                      "cuota_repercutida": "-42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "-242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Credit note
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura de abono"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""-200"",
                      ""cuota_repercutida"": ""-42""
                    }
                  ]
                }
              },
              ""importe_total"": ""-242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Credit note
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura de abono""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""-200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""-42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""-242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Invoice replacing simplified invoices
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de canje de simplificadas",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Invoice replacing simplified invoices
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de canje de simplificadas",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Invoice replacing simplified invoices
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de canje de simplificadas",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Invoice replacing simplified invoices
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de canje de simplificadas",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Invoice replacing simplified invoices
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura de canje de simplificadas",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Invoice replacing simplified invoices
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F3\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura de canje de simplificadas\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"facturas_sustituidas\": [\n    {\n      \"serie\": \"SIMPLE\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"CURRENT_DATE\"\n    }\n  ],\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Invoice replacing simplified invoices
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F3",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura de canje de simplificadas",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "facturas_sustituidas": [
                                {
                                  "serie": "SIMPLE",
                                  "numero": "1",
                                  "fecha_expedicion": "CURRENT_DATE"
                                }
                              ],
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Invoice replacing simplified invoices
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F3"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura de canje de simplificadas"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""facturas_sustituidas"": [
                {
                  ""serie"": ""SIMPLE"",
                  ""numero"": ""1"",
                  ""fecha_expedicion"": ""CURRENT_DATE""
                }
              ],
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Invoice replacing simplified invoices
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F3""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura de canje de simplificadas""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""facturas_sustituidas"": [" & vbCrLf
            sBody = sBody & "    {" & vbCrLf
            sBody = sBody & "      ""serie"": ""SIMPLE""," & vbCrLf
            sBody = sBody & "      ""numero"": ""1""," & vbCrLf
            sBody = sBody & "      ""fecha_expedicion"": ""CURRENT_DATE""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Corrective invoice by substitution
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por sustitución",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "importe_rectificativa": {
                "base_rectificada": "200",
                "cuota_rectificada": "42"
              },
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "150",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "181.5"
            }'
        - lang: Python
          label: Python — Corrective invoice by substitution
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por sustitución",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "importe_rectificativa": {
                "base_rectificada": "200",
                "cuota_rectificada": "42"
              },
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "150",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "181.5"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Corrective invoice by substitution
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por sustitución",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "importe_rectificativa": {
                "base_rectificada": "200",
                "cuota_rectificada": "42"
              },
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "150",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "181.5"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Corrective invoice by substitution
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por sustitución",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "importe_rectificativa": {
                "base_rectificada": "200",
                "cuota_rectificada": "42"
              },
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "150",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "181.5"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Corrective invoice by substitution
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por sustitución",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "importe_rectificativa": {
                "base_rectificada": "200",
                "cuota_rectificada": "42"
              },
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "150",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "181.5"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Corrective invoice by substitution
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"R\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"R1\",\n  \"tipo_rectificativa\": \"S\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Rectificativa por sustitución\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"facturas_rectificadas\": [\n    {\n      \"serie\": \"A\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"CURRENT_DATE\"\n    }\n  ],\n  \"importe_rectificativa\": {\n    \"base_rectificada\": \"200\",\n    \"cuota_rectificada\": \"42\"\n  },\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"150\",\n          \"cuota_repercutida\": \"31.5\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"181.5\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Corrective invoice by substitution
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "R",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "R1",
                              "tipo_rectificativa": "S",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Rectificativa por sustitución",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "facturas_rectificadas": [
                                {
                                  "serie": "A",
                                  "numero": "1",
                                  "fecha_expedicion": "CURRENT_DATE"
                                }
                              ],
                              "importe_rectificativa": {
                                "base_rectificada": "200",
                                "cuota_rectificada": "42"
                              },
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "150",
                                      "cuota_repercutida": "31.5"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "181.5"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Corrective invoice by substitution
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""R"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""R1"",
              ""tipo_rectificativa"": ""S"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Rectificativa por sustitución"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""facturas_rectificadas"": [
                {
                  ""serie"": ""A"",
                  ""numero"": ""1"",
                  ""fecha_expedicion"": ""CURRENT_DATE""
                }
              ],
              ""importe_rectificativa"": {
                ""base_rectificada"": ""200"",
                ""cuota_rectificada"": ""42""
              },
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""150"",
                      ""cuota_repercutida"": ""31.5""
                    }
                  ]
                }
              },
              ""importe_total"": ""181.5""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Corrective invoice by substitution
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""R""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""R1""," & vbCrLf
            sBody = sBody & "  ""tipo_rectificativa"": ""S""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Rectificativa por sustitución""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""facturas_rectificadas"": [" & vbCrLf
            sBody = sBody & "    {" & vbCrLf
            sBody = sBody & "      ""serie"": ""A""," & vbCrLf
            sBody = sBody & "      ""numero"": ""1""," & vbCrLf
            sBody = sBody & "      ""fecha_expedicion"": ""CURRENT_DATE""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""importe_rectificativa"": {" & vbCrLf
            sBody = sBody & "    ""base_rectificada"": ""200""," & vbCrLf
            sBody = sBody & "    ""cuota_rectificada"": ""42""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""150""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""31.5""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""181.5""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Corrective invoice by differences
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por diferencias",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-50",
                      "cuota_repercutida": "-10.5"
                    }
                  ]
                }
              },
              "importe_total": "-60.5"
            }'
        - lang: Python
          label: Python — Corrective invoice by differences
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por diferencias",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-50",
                      "cuota_repercutida": "-10.5"
                    }
                  ]
                }
              },
              "importe_total": "-60.5"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Corrective invoice by differences
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por diferencias",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-50",
                      "cuota_repercutida": "-10.5"
                    }
                  ]
                }
              },
              "importe_total": "-60.5"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Corrective invoice by differences
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por diferencias",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-50",
                      "cuota_repercutida": "-10.5"
                    }
                  ]
                }
              },
              "importe_total": "-60.5"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Corrective invoice by differences
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Rectificativa por diferencias",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "-50",
                      "cuota_repercutida": "-10.5"
                    }
                  ]
                }
              },
              "importe_total": "-60.5"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Corrective invoice by differences
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"R\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"R1\",\n  \"tipo_rectificativa\": \"I\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Rectificativa por diferencias\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"facturas_rectificadas\": [\n    {\n      \"serie\": \"A\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"CURRENT_DATE\"\n    }\n  ],\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"-50\",\n          \"cuota_repercutida\": \"-10.5\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"-60.5\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Corrective invoice by differences
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "R",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "R1",
                              "tipo_rectificativa": "I",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Rectificativa por diferencias",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "facturas_rectificadas": [
                                {
                                  "serie": "A",
                                  "numero": "1",
                                  "fecha_expedicion": "CURRENT_DATE"
                                }
                              ],
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "-50",
                                      "cuota_repercutida": "-10.5"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "-60.5"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Corrective invoice by differences
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""R"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""R1"",
              ""tipo_rectificativa"": ""I"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Rectificativa por diferencias"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""facturas_rectificadas"": [
                {
                  ""serie"": ""A"",
                  ""numero"": ""1"",
                  ""fecha_expedicion"": ""CURRENT_DATE""
                }
              ],
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""-50"",
                      ""cuota_repercutida"": ""-10.5""
                    }
                  ]
                }
              },
              ""importe_total"": ""-60.5""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Corrective invoice by differences
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""R""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""R1""," & vbCrLf
            sBody = sBody & "  ""tipo_rectificativa"": ""I""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Rectificativa por diferencias""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""facturas_rectificadas"": [" & vbCrLf
            sBody = sBody & "    {" & vbCrLf
            sBody = sBody & "      ""serie"": ""A""," & vbCrLf
            sBody = sBody & "      ""numero"": ""1""," & vbCrLf
            sBody = sBody & "      ""fecha_expedicion"": ""CURRENT_DATE""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""-50""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""-10.5""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""-60.5""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Equivalence surcharge
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con recargo de equivalencia",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42",
                      "tipo_recargo_equivalencia": "5.2",
                      "cuota_recargo_equivalencia": "10.4"
                    }
                  ]
                }
              },
              "importe_total": "252.4"
            }'
        - lang: Python
          label: Python — Equivalence surcharge
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con recargo de equivalencia",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42",
                      "tipo_recargo_equivalencia": "5.2",
                      "cuota_recargo_equivalencia": "10.4"
                    }
                  ]
                }
              },
              "importe_total": "252.4"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Equivalence surcharge
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con recargo de equivalencia",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42",
                      "tipo_recargo_equivalencia": "5.2",
                      "cuota_recargo_equivalencia": "10.4"
                    }
                  ]
                }
              },
              "importe_total": "252.4"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Equivalence surcharge
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con recargo de equivalencia",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42",
                      "tipo_recargo_equivalencia": "5.2",
                      "cuota_recargo_equivalencia": "10.4"
                    }
                  ]
                }
              },
              "importe_total": "252.4"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Equivalence surcharge
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura con recargo de equivalencia",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42",
                      "tipo_recargo_equivalencia": "5.2",
                      "cuota_recargo_equivalencia": "10.4"
                    }
                  ]
                }
              },
              "importe_total": "252.4"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Equivalence surcharge
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura con recargo de equivalencia\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\",\n          \"tipo_recargo_equivalencia\": \"5.2\",\n          \"cuota_recargo_equivalencia\": \"10.4\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"252.4\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Equivalence surcharge
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura con recargo de equivalencia",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42",
                                      "tipo_recargo_equivalencia": "5.2",
                                      "cuota_recargo_equivalencia": "10.4"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "252.4"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Equivalence surcharge
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura con recargo de equivalencia"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42"",
                      ""tipo_recargo_equivalencia"": ""5.2"",
                      ""cuota_recargo_equivalencia"": ""10.4""
                    }
                  ]
                }
              },
              ""importe_total"": ""252.4""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Equivalence surcharge
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura con recargo de equivalencia""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""," & vbCrLf
            sBody = sBody & "          ""tipo_recargo_equivalencia"": ""5.2""," & vbCrLf
            sBody = sBody & "          ""cuota_recargo_equivalencia"": ""10.4""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""252.4""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Issued by a third party or by the recipient
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura emitida por terceros",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "especial": {
                "emitida_por_tercero_o_destinatario": "S"
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Issued by a third party or by the recipient
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura emitida por terceros",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "especial": {
                "emitida_por_tercero_o_destinatario": "S"
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Issued by a third party or by the recipient
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura emitida por terceros",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "especial": {
                "emitida_por_tercero_o_destinatario": "S"
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Issued by a third party or by the recipient
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura emitida por terceros",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "especial": {
                "emitida_por_tercero_o_destinatario": "S"
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Issued by a third party or by the recipient
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura emitida por terceros",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "especial": {
                "emitida_por_tercero_o_destinatario": "S"
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Issued by a third party or by the recipient
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura emitida por terceros\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"especial\": {\n    \"emitida_por_tercero_o_destinatario\": \"S\"\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Issued by a third party or by the recipient
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura emitida por terceros",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "especial": {
                                "emitida_por_tercero_o_destinatario": "S"
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Issued by a third party or by the recipient
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura emitida por terceros"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""especial"": {
                ""emitida_por_tercero_o_destinatario"": ""S""
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Issued by a third party or by the recipient
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura emitida por terceros""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""especial"": {" & vbCrLf
            sBody = sBody & "    ""emitida_por_tercero_o_destinatario"": ""S""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Second-hand goods scheme
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "03"
              ],
              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "826.45",
                      "cuota_repercutida": "173.55"
                    }
                  ]
                }
              },
              "importe_total": "3000"
            }'
        - lang: Python
          label: Python — Second-hand goods scheme
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "03"
              ],
              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "826.45",
                      "cuota_repercutida": "173.55"
                    }
                  ]
                }
              },
              "importe_total": "3000"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Second-hand goods scheme
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "03"
              ],
              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "826.45",
                      "cuota_repercutida": "173.55"
                    }
                  ]
                }
              },
              "importe_total": "3000"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Second-hand goods scheme
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "03"
              ],
              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "826.45",
                      "cuota_repercutida": "173.55"
                    }
                  ]
                }
              },
              "importe_total": "3000"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Second-hand goods scheme
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "03"
              ],
              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "826.45",
                      "cuota_repercutida": "173.55"
                    }
                  ]
                }
              },
              "importe_total": "3000"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Second-hand goods scheme
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"03\"\n  ],\n  \"descripcion\": \"Factura en régimen especial de bienes usados (REBU)\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"826.45\",\n          \"cuota_repercutida\": \"173.55\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"3000\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Second-hand goods scheme
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "03"
                              ],
                              "descripcion": "Factura en régimen especial de bienes usados (REBU)",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "826.45",
                                      "cuota_repercutida": "173.55"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "3000"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Second-hand goods scheme
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""03""
              ],
              ""descripcion"": ""Factura en régimen especial de bienes usados (REBU)"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""826.45"",
                      ""cuota_repercutida"": ""173.55""
                    }
                  ]
                }
              },
              ""importe_total"": ""3000""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Second-hand goods scheme
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""03""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura en régimen especial de bienes usados (REBU)""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""826.45""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""173.55""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""3000""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Reverse charge
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Inversión del sujeto pasivo",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S2",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "0",
                      "base_imponible": "1000",
                      "cuota_repercutida": "0"
                    }
                  ]
                }
              },
              "importe_total": "1000"
            }'
        - lang: Python
          label: Python — Reverse charge
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Inversión del sujeto pasivo",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S2",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "0",
                      "base_imponible": "1000",
                      "cuota_repercutida": "0"
                    }
                  ]
                }
              },
              "importe_total": "1000"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Reverse charge
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Inversión del sujeto pasivo",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S2",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "0",
                      "base_imponible": "1000",
                      "cuota_repercutida": "0"
                    }
                  ]
                }
              },
              "importe_total": "1000"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Reverse charge
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Inversión del sujeto pasivo",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S2",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "0",
                      "base_imponible": "1000",
                      "cuota_repercutida": "0"
                    }
                  ]
                }
              },
              "importe_total": "1000"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Reverse charge
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Inversión del sujeto pasivo",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S2",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "0",
                      "base_imponible": "1000",
                      "cuota_repercutida": "0"
                    }
                  ]
                }
              },
              "importe_total": "1000"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Reverse charge
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Inversión del sujeto pasivo\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S2\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"0\",\n          \"base_imponible\": \"1000\",\n          \"cuota_repercutida\": \"0\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"1000\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Reverse charge
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Inversión del sujeto pasivo",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S2",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "0",
                                      "base_imponible": "1000",
                                      "cuota_repercutida": "0"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "1000"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Reverse charge
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Inversión del sujeto pasivo"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S2"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""0"",
                      ""base_imponible"": ""1000"",
                      ""cuota_repercutida"": ""0""
                    }
                  ]
                }
              },
              ""importe_total"": ""1000""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Reverse charge
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Inversión del sujeto pasivo""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S2""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""0""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""1000""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""0""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""1000""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Summary entry
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "T",
              "numero": "1",
              "numero_fin": "50",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F4",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Asiento resumen de los tickets del día",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "4000",
                      "cuota_repercutida": "840"
                    }
                  ]
                }
              },
              "importe_total": "4840"
            }'
        - lang: Python
          label: Python — Summary entry
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "T",
              "numero": "1",
              "numero_fin": "50",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F4",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Asiento resumen de los tickets del día",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "4000",
                      "cuota_repercutida": "840"
                    }
                  ]
                }
              },
              "importe_total": "4840"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Summary entry
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "T",
              "numero": "1",
              "numero_fin": "50",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F4",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Asiento resumen de los tickets del día",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "4000",
                      "cuota_repercutida": "840"
                    }
                  ]
                }
              },
              "importe_total": "4840"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Summary entry
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "T",
              "numero": "1",
              "numero_fin": "50",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F4",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Asiento resumen de los tickets del día",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "4000",
                      "cuota_repercutida": "840"
                    }
                  ]
                }
              },
              "importe_total": "4840"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Summary entry
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "T",
              "numero": "1",
              "numero_fin": "50",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F4",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Asiento resumen de los tickets del día",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "4000",
                      "cuota_repercutida": "840"
                    }
                  ]
                }
              },
              "importe_total": "4840"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Summary entry
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"T\",\n  \"numero\": \"1\",\n  \"numero_fin\": \"50\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F4\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Asiento resumen de los tickets del día\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"4000\",\n          \"cuota_repercutida\": \"840\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"4840\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Summary entry
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "T",
                              "numero": "1",
                              "numero_fin": "50",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F4",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Asiento resumen de los tickets del día",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "4000",
                                      "cuota_repercutida": "840"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "4840"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Summary entry
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""T"",
              ""numero"": ""1"",
              ""numero_fin"": ""50"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F4"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Asiento resumen de los tickets del día"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""4000"",
                      ""cuota_repercutida"": ""840""
                    }
                  ]
                }
              },
              ""importe_total"": ""4840""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Summary entry
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""T""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""numero_fin"": ""50""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F4""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Asiento resumen de los tickets del día""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""4000""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""840""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""4840""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Cash accounting scheme
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "07"
              ],
              "descripcion": "Factura en régimen especial del criterio de caja",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python — Cash accounting scheme
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "07"
              ],
              "descripcion": "Factura en régimen especial del criterio de caja",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Cash accounting scheme
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "07"
              ],
              "descripcion": "Factura en régimen especial del criterio de caja",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Cash accounting scheme
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "07"
              ],
              "descripcion": "Factura en régimen especial del criterio de caja",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Cash accounting scheme
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "07"
              ],
              "descripcion": "Factura en régimen especial del criterio de caja",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Cash accounting scheme
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"07\"\n  ],\n  \"descripcion\": \"Factura en régimen especial del criterio de caja\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Cash accounting scheme
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "07"
                              ],
                              "descripcion": "Factura en régimen especial del criterio de caja",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Cash accounting scheme
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""07""
              ],
              ""descripcion"": ""Factura en régimen especial del criterio de caja"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Cash accounting scheme
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""07""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura en régimen especial del criterio de caja""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Business premises rental
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "12"
              ],
              "descripcion": "Alquiler del local de negocio",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "inmuebles": [
                {
                  "situacion": "1",
                  "referencia_catastral": "9872023VH5797S0001WX"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "1000",
                      "cuota_repercutida": "210"
                    }
                  ]
                }
              },
              "importe_total": "1210"
            }'
        - lang: Python
          label: Python — Business premises rental
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "12"
              ],
              "descripcion": "Alquiler del local de negocio",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "inmuebles": [
                {
                  "situacion": "1",
                  "referencia_catastral": "9872023VH5797S0001WX"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "1000",
                      "cuota_repercutida": "210"
                    }
                  ]
                }
              },
              "importe_total": "1210"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Business premises rental
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "12"
              ],
              "descripcion": "Alquiler del local de negocio",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "inmuebles": [
                {
                  "situacion": "1",
                  "referencia_catastral": "9872023VH5797S0001WX"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "1000",
                      "cuota_repercutida": "210"
                    }
                  ]
                }
              },
              "importe_total": "1210"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — Business premises rental
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "12"
              ],
              "descripcion": "Alquiler del local de negocio",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "inmuebles": [
                {
                  "situacion": "1",
                  "referencia_catastral": "9872023VH5797S0001WX"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "1000",
                      "cuota_repercutida": "210"
                    }
                  ]
                }
              },
              "importe_total": "1210"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — Business premises rental
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "12"
              ],
              "descripcion": "Alquiler del local de negocio",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "inmuebles": [
                {
                  "situacion": "1",
                  "referencia_catastral": "9872023VH5797S0001WX"
                }
              ],
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "1000",
                      "cuota_repercutida": "210"
                    }
                  ]
                }
              },
              "importe_total": "1210"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Business premises rental
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"12\"\n  ],\n  \"descripcion\": \"Alquiler del local de negocio\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"inmuebles\": [\n    {\n      \"situacion\": \"1\",\n      \"referencia_catastral\": \"9872023VH5797S0001WX\"\n    }\n  ],\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"1000\",\n          \"cuota_repercutida\": \"210\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"1210\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — Business premises rental
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "12"
                              ],
                              "descripcion": "Alquiler del local de negocio",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "inmuebles": [
                                {
                                  "situacion": "1",
                                  "referencia_catastral": "9872023VH5797S0001WX"
                                }
                              ],
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "1000",
                                      "cuota_repercutida": "210"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "1210"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — Business premises rental
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""12""
              ],
              ""descripcion"": ""Alquiler del local de negocio"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""inmuebles"": [
                {
                  ""situacion"": ""1"",
                  ""referencia_catastral"": ""9872023VH5797S0001WX""
                }
              ],
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""1000"",
                      ""cuota_repercutida"": ""210""
                    }
                  ]
                }
              },
              ""importe_total"": ""1210""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Business premises rental
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""12""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Alquiler del local de negocio""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""inmuebles"": [" & vbCrLf
            sBody = sBody & "    {" & vbCrLf
            sBody = sBody & "      ""situacion"": ""1""," & vbCrLf
            sBody = sBody & "      ""referencia_catastral"": ""9872023VH5797S0001WX""" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""1000""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""210""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""1210""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — VAT group
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "06"
              ],
              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "base_imponible_a_coste": "150",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "231.5"
            }'
        - lang: Python
          label: Python — VAT group
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "06"
              ],
              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "base_imponible_a_coste": "150",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "231.5"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — VAT group
          source: |
            const url = 'https://api.verifacti.com/sii/create';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "06"
              ],
              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "base_imponible_a_coste": "150",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "231.5"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js — VAT group
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "06"
              ],
              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "base_imponible_a_coste": "150",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "231.5"
            };

            const response = await axios.post("https://api.verifacti.com/sii/create", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP — VAT group
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "06"
              ],
              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "base_imponible_a_coste": "150",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "31.5"
                    }
                  ]
                }
              },
              "importe_total": "231.5"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — VAT group
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"06\"\n  ],\n  \"descripcion\": \"Operación dentro del grupo de entidades (nivel avanzado)\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"base_imponible_a_coste\": \"150\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"31.5\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"231.5\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java — VAT group
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "06"
                              ],
                              "descripcion": "Operación dentro del grupo de entidades (nivel avanzado)",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "base_imponible_a_coste": "150",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "31.5"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "231.5"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C# — VAT group
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""06""
              ],
              ""descripcion"": ""Operación dentro del grupo de entidades (nivel avanzado)"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""base_imponible_a_coste"": ""150"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""31.5""
                    }
                  ]
                }
              },
              ""importe_total"": ""231.5""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — VAT group
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""06""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Operación dentro del grupo de entidades (nivel avanzado)""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""base_imponible_a_coste"": ""150""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""31.5""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""231.5""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          description: Optional unique key to make sure retries of the same request do not create duplicates. Printable ASCII string of 1 to 255 characters. Remembered for 24 hours per NIF.
          schema:
            type: string
            pattern: ^[\x20-\x7E]{1,255}$
            minLength: 1
            maxLength: 255
            example: 8e1b9c2a-3f4d-4a6b-9c2e-1d2f3e4a5b6c
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Factura"
            examples:
              factura_normal:
                summary: Standard invoice
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura normal
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  importe_total: "242"
              factura_simplificada:
                summary: Simplified invoice
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F2
                  clave_regimen:
                    - "01"
                  descripcion: Factura simplificada
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  importe_total: "242"
              multiples_ivas:
                summary: Multiple VAT rates
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura con múltiples IVAs
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                        - tipo_impositivo: "10"
                          base_imponible: "100"
                          cuota_repercutida: "10"
                        - tipo_impositivo: "4"
                          base_imponible: "50"
                          cuota_repercutida: "2"
                  importe_total: "404"
              b2b_intracomunitaria_bienes:
                summary: Intra-EU B2B - Sale of goods
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura B2B intracomunitaria - Venta de bienes
                  nombre: Nombre destinatario
                  id_otro:
                    id_type: "02"
                    id: BE0404621642
                  desglose:
                    entrega:
                      exenta:
                        - causa_exencion: E5
                          base_imponible: "200"
                  importe_total: "200"
              b2b_intracomunitaria_servicios:
                summary: Intra-EU B2B - Provision of services
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura B2B intracomunitaria - Prestación de servicios
                  nombre: Nombre destinatario
                  id_otro:
                    id_type: "02"
                    id: BE0404621642
                  desglose:
                    prestacion_servicios:
                      no_sujeta:
                        importe_tai_reglas_localizacion: "200"
                  importe_total: "200"
              b2c_intracomunitaria_umbral:
                summary: Intra-EU B2C - Below the threshold
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura B2C intracomunitaria - Por debajo del umbral
                  nombre: Nombre destinatario
                  id_otro:
                    codigo_pais: DE
                    id_type: "03"
                    id: F8624KW3J6
                  desglose:
                    entrega:
                      no_exenta:
                        tipo_no_exenta: S1
                        detalle_iva:
                          - tipo_impositivo: "21"
                            base_imponible: "200"
                            cuota_repercutida: "42"
                  importe_total: "242"
              b2c_intracomunitaria_oss:
                summary: Intra-EU B2C - OSS
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "17"
                  descripcion: Factura B2C intracomunitaria - OSS
                  nombre: Nombre destinatario
                  id_otro:
                    codigo_pais: DE
                    id_type: "03"
                    id: F8624KW3J6
                  desglose:
                    entrega:
                      no_sujeta:
                        importe_tai_reglas_localizacion: "200"
                  importe_total: "200"
              exportacion_bienes:
                summary: "Outside the EU: Export of goods"
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "02"
                  descripcion: Factura extracomunitaria - Exportación de bienes
                  nombre: Nombre destinatario
                  id_otro:
                    codigo_pais: US
                    id_type: "03"
                    id: M76543210
                  desglose:
                    entrega:
                      exenta:
                        - causa_exencion: E2
                          base_imponible: "200"
                  importe_total: "200"
              extracomunitaria_servicios:
                summary: "Outside the EU: Provision of services"
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura extracomunitaria - Prestación de servicios
                  nombre: Nombre destinatario
                  id_otro:
                    codigo_pais: US
                    id_type: "03"
                    id: M76543210
                  desglose:
                    prestacion_servicios:
                      no_sujeta:
                        importe_tai_reglas_localizacion: "200"
                  importe_total: "200"
              exenta:
                summary: VAT-exempt
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura exenta de IVA
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    exenta:
                      - causa_exencion: E1
                        base_imponible: "200"
                  importe_total: "200"
              no_sujeta:
                summary: Transaction not subject to VAT
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Operación no sujeta
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_sujeta:
                      importe_por_articulos_7_14_otros: "200"
                  importe_total: "200"
              igic_ipsi:
                summary: Transaction subject to IGIC or IPSI
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "08"
                  descripcion: Operación sujeta a IGIC (Canarias)
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_sujeta:
                      importe_tai_reglas_localizacion: "200"
                  importe_total: "200"
              abono:
                summary: Credit note
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura de abono
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "-200"
                          cuota_repercutida: "-42"
                  importe_total: "-242"
              canje:
                summary: Invoice replacing simplified invoices
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F3
                  clave_regimen:
                    - "01"
                  descripcion: Factura de canje de simplificadas
                  nombre: Nombre cliente
                  nif: A15022510
                  facturas_sustituidas:
                    - serie: SIMPLE
                      numero: "1"
                      fecha_expedicion: CURRENT_DATE
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  importe_total: "242"
              rectificativa_sustitucion:
                summary: Corrective invoice by substitution
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: R
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: R1
                  tipo_rectificativa: S
                  clave_regimen:
                    - "01"
                  descripcion: Rectificativa por sustitución
                  nombre: Nombre cliente
                  nif: A15022510
                  facturas_rectificadas:
                    - serie: A
                      numero: "1"
                      fecha_expedicion: CURRENT_DATE
                  importe_rectificativa:
                    base_rectificada: "200"
                    cuota_rectificada: "42"
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "150"
                          cuota_repercutida: "31.5"
                  importe_total: "181.5"
              rectificativa_diferencias:
                summary: Corrective invoice by differences
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: R
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: R1
                  tipo_rectificativa: I
                  clave_regimen:
                    - "01"
                  descripcion: Rectificativa por diferencias
                  nombre: Nombre cliente
                  nif: A15022510
                  facturas_rectificadas:
                    - serie: A
                      numero: "1"
                      fecha_expedicion: CURRENT_DATE
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "-50"
                          cuota_repercutida: "-10.5"
                  importe_total: "-60.5"
              recargo_equivalencia:
                summary: Equivalence surcharge
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura con recargo de equivalencia
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                          tipo_recargo_equivalencia: "5.2"
                          cuota_recargo_equivalencia: "10.4"
                  importe_total: "252.4"
              emitida_por_terceros:
                summary: Issued by a third party or by the recipient
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura emitida por terceros
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  especial:
                    emitida_por_tercero_o_destinatario: S
                  importe_total: "242"
              rebu:
                summary: Second-hand goods scheme
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "03"
                  descripcion: Factura en régimen especial de bienes usados (REBU)
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "826.45"
                          cuota_repercutida: "173.55"
                  importe_total: "3000"
              inversion_sujeto_pasivo:
                summary: Reverse charge
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Inversión del sujeto pasivo
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S2
                      detalle_iva:
                        - tipo_impositivo: "0"
                          base_imponible: "1000"
                          cuota_repercutida: "0"
                  importe_total: "1000"
              asiento_resumen:
                summary: Summary entry
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: T
                  numero: "1"
                  numero_fin: "50"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F4
                  clave_regimen:
                    - "01"
                  descripcion: Asiento resumen de los tickets del día
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "4000"
                          cuota_repercutida: "840"
                  importe_total: "4840"
              criterio_de_caja:
                summary: Cash accounting scheme
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "07"
                  descripcion: Factura en régimen especial del criterio de caja
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  importe_total: "242"
              arrendamiento_local:
                summary: Business premises rental
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "12"
                  descripcion: Alquiler del local de negocio
                  nombre: Nombre cliente
                  nif: A15022510
                  inmuebles:
                    - situacion: "1"
                      referencia_catastral: 9872023VH5797S0001WX
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "1000"
                          cuota_repercutida: "210"
                  importe_total: "1210"
              grupo_de_entidades:
                summary: VAT group
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "06"
                  descripcion: Operación dentro del grupo de entidades (nivel avanzado)
                  nombre: Nombre cliente
                  nif: A15022510
                  base_imponible_a_coste: "150"
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "31.5"
                  importe_total: "231.5"
      responses:
        "200":
          description: Valid invoice, queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier, to check its status.
                    type: string
                    example: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
                  estado:
                    description: "Always <code>Pendiente</code>: the record is queued."
                    type: string
                    example: Pendiente
        "400":
          description: Error in the request data. The record is not created and nothing is sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description.
                    type: string
                    example: La cuota_repercutida debe ser base_imponible (o base_imponible_a_coste con la clave 06) por tipo_impositivo / 100, con un margen de 10 euros.
                  codigo:
                    description: Stable error identifier. Full catalogue <a href="https://www.verifacti.com/openapi/codigos-sii.yaml" target="_blank">here</a>.
                    type: string
                    example: vf-sii-cuota_repercutida_calculo
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "500":
          description: Server error. The record is not created; retry later.
  /sii/create_bulk:
    post:
      summary: Create invoices in bulk
      description: |-
        This endpoint creates up to 500 registration records (A0) in a single call. The body of the call is an array of invoices, as they are sent to the <code>/sii/create</code> endpoint. In the same way, the response is an array with the <code>uuid</code> and the status of each record, in the same order as the invoices.

        &nbsp;

        Every invoice is validated before any is stored, including the check of the counterparties in the AEAT census and in VIES, which is done for the whole batch at once. If any has an error, a 400 is returned with the error of the first one that fails (<code>Error en factura N: …</code>) and its <code>codigo</code>. In that case no record is created and nothing is sent to the AEAT. The batch is also rejected if two invoices have the same series, number and issue date (<code>vf-sii-factura_duplicada_lote</code>).

        &nbsp;

        The batch's records are sent to the AEAT together with the NIF's other pending records, and each one is checked with <code>GET /sii/status</code> or reaches your webhooks. Modifications and cancellations are still sent one invoice at a time, with <code>/sii/modify</code> and <code>/sii/cancel</code>.

        &nbsp;

        This endpoint also accepts an optional <code>Idempotency-Key</code> header. If included, retries of the same batch with the same key replay the original response (including the <code>Idempotent-Replayed: true</code> response header and the echoed <code>Idempotency-Key</code>). The key covers the whole batch: the same array of invoices returns the same array of results. Keys are bound to the NIF and remembered for 24 hours. Reusing the same key with a different body returns 422; a concurrent retry while the first one is still in progress returns 409.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request POST 'https://api.verifacti.com/sii/create_bulk' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '[
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura normal",
                "nombre": "Nombre cliente",
                "nif": "A15022510",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura simplificada",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "3",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                "nombre": "Nombre destinatario",
                "id_otro": {
                  "id_type": "02",
                  "id": "BE0404621642"
                },
                "desglose": {
                  "entrega": {
                    "exenta": [
                      {
                        "causa_exencion": "E5",
                        "base_imponible": "200"
                      }
                    ]
                  }
                },
                "importe_total": "200"
              }
            ]'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/create_bulk'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = [
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura normal",
                "nombre": "Nombre cliente",
                "nif": "A15022510",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura simplificada",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "3",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                "nombre": "Nombre destinatario",
                "id_otro": {
                  "id_type": "02",
                  "id": "BE0404621642"
                },
                "desglose": {
                  "entrega": {
                    "exenta": [
                      {
                        "causa_exencion": "E5",
                        "base_imponible": "200"
                      }
                    ]
                  }
                },
                "importe_total": "200"
              }
            ]
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/create_bulk';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = [
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura normal",
                "nombre": "Nombre cliente",
                "nif": "A15022510",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura simplificada",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "3",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                "nombre": "Nombre destinatario",
                "id_otro": {
                  "id_type": "02",
                  "id": "BE0404621642"
                },
                "desglose": {
                  "entrega": {
                    "exenta": [
                      {
                        "causa_exencion": "E5",
                        "base_imponible": "200"
                      }
                    ]
                  }
                },
                "importe_total": "200"
              }
            ];
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = [
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura normal",
                "nombre": "Nombre cliente",
                "nif": "A15022510",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura simplificada",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "3",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                "nombre": "Nombre destinatario",
                "id_otro": {
                  "id_type": "02",
                  "id": "BE0404621642"
                },
                "desglose": {
                  "entrega": {
                    "exenta": [
                      {
                        "causa_exencion": "E5",
                        "base_imponible": "200"
                      }
                    ]
                  }
                },
                "importe_total": "200"
              }
            ];

            const response = await axios.post("https://api.verifacti.com/sii/create_bulk", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/create_bulk";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            [
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura normal",
                "nombre": "Nombre cliente",
                "nif": "A15022510",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura simplificada",
                "desglose": {
                  "no_exenta": {
                    "tipo_no_exenta": "S1",
                    "detalle_iva": [
                      {
                        "tipo_impositivo": "21",
                        "base_imponible": "200",
                        "cuota_repercutida": "42"
                      }
                    ]
                  }
                },
                "importe_total": "242"
              },
              {
                "ejercicio": "CURRENT_YEAR",
                "periodo": "CURRENT_MONTH",
                "serie": "A",
                "numero": "3",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "clave_regimen": [
                  "01"
                ],
                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                "nombre": "Nombre destinatario",
                "id_otro": {
                  "id_type": "02",
                  "id": "BE0404621642"
                },
                "desglose": {
                  "entrega": {
                    "exenta": [
                      {
                        "causa_exencion": "E5",
                        "base_imponible": "200"
                      }
                    ]
                  }
                },
                "importe_total": "200"
              }
            ]
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n[\n  {\n    \"ejercicio\": \"CURRENT_YEAR\",\n    \"periodo\": \"CURRENT_MONTH\",\n    \"serie\": \"A\",\n    \"numero\": \"1\",\n    \"fecha_expedicion\": \"CURRENT_DATE\",\n    \"tipo_factura\": \"F1\",\n    \"clave_regimen\": [\n      \"01\"\n    ],\n    \"descripcion\": \"Factura normal\",\n    \"nombre\": \"Nombre cliente\",\n    \"nif\": \"A15022510\",\n    \"desglose\": {\n      \"no_exenta\": {\n        \"tipo_no_exenta\": \"S1\",\n        \"detalle_iva\": [\n          {\n            \"tipo_impositivo\": \"21\",\n            \"base_imponible\": \"200\",\n            \"cuota_repercutida\": \"42\"\n          }\n        ]\n      }\n    },\n    \"importe_total\": \"242\"\n  },\n  {\n    \"ejercicio\": \"CURRENT_YEAR\",\n    \"periodo\": \"CURRENT_MONTH\",\n    \"serie\": \"A\",\n    \"numero\": \"2\",\n    \"fecha_expedicion\": \"CURRENT_DATE\",\n    \"tipo_factura\": \"F2\",\n    \"clave_regimen\": [\n      \"01\"\n    ],\n    \"descripcion\": \"Factura simplificada\",\n    \"desglose\": {\n      \"no_exenta\": {\n        \"tipo_no_exenta\": \"S1\",\n        \"detalle_iva\": [\n          {\n            \"tipo_impositivo\": \"21\",\n            \"base_imponible\": \"200\",\n            \"cuota_repercutida\": \"42\"\n          }\n        ]\n      }\n    },\n    \"importe_total\": \"242\"\n  },\n  {\n    \"ejercicio\": \"CURRENT_YEAR\",\n    \"periodo\": \"CURRENT_MONTH\",\n    \"serie\": \"A\",\n    \"numero\": \"3\",\n    \"fecha_expedicion\": \"CURRENT_DATE\",\n    \"tipo_factura\": \"F1\",\n    \"clave_regimen\": [\n      \"01\"\n    ],\n    \"descripcion\": \"Factura B2B intracomunitaria - Venta de bienes\",\n    \"nombre\": \"Nombre destinatario\",\n    \"id_otro\": {\n      \"id_type\": \"02\",\n      \"id\": \"BE0404621642\"\n    },\n    \"desglose\": {\n      \"entrega\": {\n        \"exenta\": [\n          {\n            \"causa_exencion\": \"E5\",\n            \"base_imponible\": \"200\"\n          }\n        ]\n      }\n    },\n    \"importe_total\": \"200\"\n  }\n]\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/create_bulk\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            [
                              {
                                "ejercicio": "CURRENT_YEAR",
                                "periodo": "CURRENT_MONTH",
                                "serie": "A",
                                "numero": "1",
                                "fecha_expedicion": "CURRENT_DATE",
                                "tipo_factura": "F1",
                                "clave_regimen": [
                                  "01"
                                ],
                                "descripcion": "Factura normal",
                                "nombre": "Nombre cliente",
                                "nif": "A15022510",
                                "desglose": {
                                  "no_exenta": {
                                    "tipo_no_exenta": "S1",
                                    "detalle_iva": [
                                      {
                                        "tipo_impositivo": "21",
                                        "base_imponible": "200",
                                        "cuota_repercutida": "42"
                                      }
                                    ]
                                  }
                                },
                                "importe_total": "242"
                              },
                              {
                                "ejercicio": "CURRENT_YEAR",
                                "periodo": "CURRENT_MONTH",
                                "serie": "A",
                                "numero": "2",
                                "fecha_expedicion": "CURRENT_DATE",
                                "tipo_factura": "F2",
                                "clave_regimen": [
                                  "01"
                                ],
                                "descripcion": "Factura simplificada",
                                "desglose": {
                                  "no_exenta": {
                                    "tipo_no_exenta": "S1",
                                    "detalle_iva": [
                                      {
                                        "tipo_impositivo": "21",
                                        "base_imponible": "200",
                                        "cuota_repercutida": "42"
                                      }
                                    ]
                                  }
                                },
                                "importe_total": "242"
                              },
                              {
                                "ejercicio": "CURRENT_YEAR",
                                "periodo": "CURRENT_MONTH",
                                "serie": "A",
                                "numero": "3",
                                "fecha_expedicion": "CURRENT_DATE",
                                "tipo_factura": "F1",
                                "clave_regimen": [
                                  "01"
                                ],
                                "descripcion": "Factura B2B intracomunitaria - Venta de bienes",
                                "nombre": "Nombre destinatario",
                                "id_otro": {
                                  "id_type": "02",
                                  "id": "BE0404621642"
                                },
                                "desglose": {
                                  "entrega": {
                                    "exenta": [
                                      {
                                        "causa_exencion": "E5",
                                        "base_imponible": "200"
                                      }
                                    ]
                                  }
                                },
                                "importe_total": "200"
                              }
                            ]
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/create_bulk"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            [
              {
                ""ejercicio"": ""CURRENT_YEAR"",
                ""periodo"": ""CURRENT_MONTH"",
                ""serie"": ""A"",
                ""numero"": ""1"",
                ""fecha_expedicion"": ""CURRENT_DATE"",
                ""tipo_factura"": ""F1"",
                ""clave_regimen"": [
                  ""01""
                ],
                ""descripcion"": ""Factura normal"",
                ""nombre"": ""Nombre cliente"",
                ""nif"": ""A15022510"",
                ""desglose"": {
                  ""no_exenta"": {
                    ""tipo_no_exenta"": ""S1"",
                    ""detalle_iva"": [
                      {
                        ""tipo_impositivo"": ""21"",
                        ""base_imponible"": ""200"",
                        ""cuota_repercutida"": ""42""
                      }
                    ]
                  }
                },
                ""importe_total"": ""242""
              },
              {
                ""ejercicio"": ""CURRENT_YEAR"",
                ""periodo"": ""CURRENT_MONTH"",
                ""serie"": ""A"",
                ""numero"": ""2"",
                ""fecha_expedicion"": ""CURRENT_DATE"",
                ""tipo_factura"": ""F2"",
                ""clave_regimen"": [
                  ""01""
                ],
                ""descripcion"": ""Factura simplificada"",
                ""desglose"": {
                  ""no_exenta"": {
                    ""tipo_no_exenta"": ""S1"",
                    ""detalle_iva"": [
                      {
                        ""tipo_impositivo"": ""21"",
                        ""base_imponible"": ""200"",
                        ""cuota_repercutida"": ""42""
                      }
                    ]
                  }
                },
                ""importe_total"": ""242""
              },
              {
                ""ejercicio"": ""CURRENT_YEAR"",
                ""periodo"": ""CURRENT_MONTH"",
                ""serie"": ""A"",
                ""numero"": ""3"",
                ""fecha_expedicion"": ""CURRENT_DATE"",
                ""tipo_factura"": ""F1"",
                ""clave_regimen"": [
                  ""01""
                ],
                ""descripcion"": ""Factura B2B intracomunitaria - Venta de bienes"",
                ""nombre"": ""Nombre destinatario"",
                ""id_otro"": {
                  ""id_type"": ""02"",
                  ""id"": ""BE0404621642""
                },
                ""desglose"": {
                  ""entrega"": {
                    ""exenta"": [
                      {
                        ""causa_exencion"": ""E5"",
                        ""base_imponible"": ""200""
                      }
                    ]
                  }
                },
                ""importe_total"": ""200""
              }
            ]
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/create_bulk", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/create_bulk"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "[" & vbCrLf
            sBody = sBody & "  {" & vbCrLf
            sBody = sBody & "    ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "    ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "    ""serie"": ""A""," & vbCrLf
            sBody = sBody & "    ""numero"": ""1""," & vbCrLf
            sBody = sBody & "    ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "    ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "    ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "      ""01""" & vbCrLf
            sBody = sBody & "    ]," & vbCrLf
            sBody = sBody & "    ""descripcion"": ""Factura normal""," & vbCrLf
            sBody = sBody & "    ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "    ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "    ""desglose"": {" & vbCrLf
            sBody = sBody & "      ""no_exenta"": {" & vbCrLf
            sBody = sBody & "        ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "        ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "          {" & vbCrLf
            sBody = sBody & "            ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "            ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "            ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "          }" & vbCrLf
            sBody = sBody & "        ]" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }," & vbCrLf
            sBody = sBody & "    ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  {" & vbCrLf
            sBody = sBody & "    ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "    ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "    ""serie"": ""A""," & vbCrLf
            sBody = sBody & "    ""numero"": ""2""," & vbCrLf
            sBody = sBody & "    ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "    ""tipo_factura"": ""F2""," & vbCrLf
            sBody = sBody & "    ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "      ""01""" & vbCrLf
            sBody = sBody & "    ]," & vbCrLf
            sBody = sBody & "    ""descripcion"": ""Factura simplificada""," & vbCrLf
            sBody = sBody & "    ""desglose"": {" & vbCrLf
            sBody = sBody & "      ""no_exenta"": {" & vbCrLf
            sBody = sBody & "        ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "        ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "          {" & vbCrLf
            sBody = sBody & "            ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "            ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "            ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "          }" & vbCrLf
            sBody = sBody & "        ]" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }," & vbCrLf
            sBody = sBody & "    ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  {" & vbCrLf
            sBody = sBody & "    ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "    ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "    ""serie"": ""A""," & vbCrLf
            sBody = sBody & "    ""numero"": ""3""," & vbCrLf
            sBody = sBody & "    ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "    ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "    ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "      ""01""" & vbCrLf
            sBody = sBody & "    ]," & vbCrLf
            sBody = sBody & "    ""descripcion"": ""Factura B2B intracomunitaria - Venta de bienes""," & vbCrLf
            sBody = sBody & "    ""nombre"": ""Nombre destinatario""," & vbCrLf
            sBody = sBody & "    ""id_otro"": {" & vbCrLf
            sBody = sBody & "      ""id_type"": ""02""," & vbCrLf
            sBody = sBody & "      ""id"": ""BE0404621642""" & vbCrLf
            sBody = sBody & "    }," & vbCrLf
            sBody = sBody & "    ""desglose"": {" & vbCrLf
            sBody = sBody & "      ""entrega"": {" & vbCrLf
            sBody = sBody & "        ""exenta"": [" & vbCrLf
            sBody = sBody & "          {" & vbCrLf
            sBody = sBody & "            ""causa_exencion"": ""E5""," & vbCrLf
            sBody = sBody & "            ""base_imponible"": ""200""" & vbCrLf
            sBody = sBody & "          }" & vbCrLf
            sBody = sBody & "        ]" & vbCrLf
            sBody = sBody & "      }" & vbCrLf
            sBody = sBody & "    }," & vbCrLf
            sBody = sBody & "    ""importe_total"": ""200""" & vbCrLf
            sBody = sBody & "  }" & vbCrLf
            sBody = sBody & "]" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          description: Optional unique key to make sure retries of the same request do not create duplicates. Printable ASCII string of 1 to 255 characters. Remembered for 24 hours per NIF.
          schema:
            type: string
            pattern: ^[\x20-\x7E]{1,255}$
            minLength: 1
            maxLength: 255
            example: 8e1b9c2a-3f4d-4a6b-9c2e-1d2f3e4a5b6c
      requestBody:
        content:
          application/json:
            schema:
              type: array
              minItems: 1
              maxItems: 500
              description: Array of invoices, each in the format of <code>/sii/create</code>.
              items:
                $ref: "#/components/schemas/Factura"
            example:
              - ejercicio: CURRENT_YEAR
                periodo: CURRENT_MONTH
                serie: A
                numero: "1"
                fecha_expedicion: CURRENT_DATE
                tipo_factura: F1
                clave_regimen:
                  - "01"
                descripcion: Factura normal
                nombre: Nombre cliente
                nif: A15022510
                desglose:
                  no_exenta:
                    tipo_no_exenta: S1
                    detalle_iva:
                      - tipo_impositivo: "21"
                        base_imponible: "200"
                        cuota_repercutida: "42"
                importe_total: "242"
              - ejercicio: CURRENT_YEAR
                periodo: CURRENT_MONTH
                serie: A
                numero: "2"
                fecha_expedicion: CURRENT_DATE
                tipo_factura: F2
                clave_regimen:
                  - "01"
                descripcion: Factura simplificada
                desglose:
                  no_exenta:
                    tipo_no_exenta: S1
                    detalle_iva:
                      - tipo_impositivo: "21"
                        base_imponible: "200"
                        cuota_repercutida: "42"
                importe_total: "242"
              - ejercicio: CURRENT_YEAR
                periodo: CURRENT_MONTH
                serie: A
                numero: "3"
                fecha_expedicion: CURRENT_DATE
                tipo_factura: F1
                clave_regimen:
                  - "01"
                descripcion: Factura B2B intracomunitaria - Venta de bienes
                nombre: Nombre destinatario
                id_otro:
                  id_type: "02"
                  id: BE0404621642
                desglose:
                  entrega:
                    exenta:
                      - causa_exencion: E5
                        base_imponible: "200"
                importe_total: "200"
      responses:
        "200":
          description: Valid invoices, queued
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    uuid:
                      description: Unique record identifier, to check its status.
                      type: string
                    estado:
                      description: "Always <code>Pendiente</code>: the record is queued."
                      type: string
              example:
                - uuid: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
                  estado: Pendiente
                - uuid: 3b1f0c7e-5d2a-4c8e-9f6b-7a2d1e4c9b05
                  estado: Pendiente
                - uuid: c9d84a1b-2e6f-4b3a-8d7c-0f5e9a1b2c3d
                  estado: Pendiente
        "400":
          description: "Error in the request data: the body is not an array, it has more than 500 invoices or an invoice has an error. No record is created and nothing is sent to the AEAT."
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description.
                    type: string
                    example: "Error en factura 2: Factura con misma serie, numero y fecha_expedicion duplicada en el lote."
                  codigo:
                    description: Stable error identifier. Full catalogue <a href="https://www.verifacti.com/openapi/codigos-sii.yaml" target="_blank">here</a>.
                    type: string
                    example: vf-sii-factura_duplicada_lote
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "500":
          description: Server error. The record is not created; retry later.
  /sii/modify:
    put:
      summary: Modify invoice
      description: |-
        Creates a modification record (A1), which replaces the whole record the AEAT holds for the invoice. The invoice is identified by <code>serie</code>, <code>numero</code> and <code>fecha_expedicion</code>, and the body is the same as in <code>/sii/create</code>.
        <ul style="list-style: disc;">
          <li>It only works for invoices the AEAT has registered (<code>Correcto</code>, <code>Aceptado con errores</code> or <code>Duplicado</code>). An invoice in <code>Incorrecto</code> or <code>No registrado</code> is sent again with <code>/sii/create</code>.</li>
          <li>It can change any data of the invoice, the tax period included.</li>
          <li>On a cancelled invoice, it registers it again.</li>
        </ul>

        This endpoint also accepts an optional `Idempotency-Key` header. If included, retries of the same logical request with the same key replay the original response (including the `Idempotent-Replayed: true` response header and the echoed `Idempotency-Key`). Keys are bound to the NIF and remembered for 24 hours. Reusing the same key with a different body returns 422; a concurrent retry while the first one is still in progress returns 409. See the "Idempotency" section at the start of this documentation for details.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request PUT 'https://api.verifacti.com/sii/modify' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal (descripción corregida)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/modify'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal (descripción corregida)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            response = requests.put(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/modify';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal (descripción corregida)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };
            fetch(url, { headers, method: 'PUT', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal (descripción corregida)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            };

            const response = await axios.put("https://api.verifacti.com/sii/modify", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/modify";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "clave_regimen": [
                "01"
              ],
              "descripcion": "Factura normal (descripción corregida)",
              "nombre": "Nombre cliente",
              "nif": "A15022510",
              "desglose": {
                "no_exenta": {
                  "tipo_no_exenta": "S1",
                  "detalle_iva": [
                    {
                      "tipo_impositivo": "21",
                      "base_imponible": "200",
                      "cuota_repercutida": "42"
                    }
                  ]
                }
              },
              "importe_total": "242"
            }
            JSON;

            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"clave_regimen\": [\n    \"01\"\n  ],\n  \"descripcion\": \"Factura normal (descripción corregida)\",\n  \"nombre\": \"Nombre cliente\",\n  \"nif\": \"A15022510\",\n  \"desglose\": {\n    \"no_exenta\": {\n      \"tipo_no_exenta\": \"S1\",\n      \"detalle_iva\": [\n        {\n          \"tipo_impositivo\": \"21\",\n          \"base_imponible\": \"200\",\n          \"cuota_repercutida\": \"42\"\n        }\n      ]\n    }\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"PUT\", \"https://api.verifacti.com/sii/modify\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "clave_regimen": [
                                "01"
                              ],
                              "descripcion": "Factura normal (descripción corregida)",
                              "nombre": "Nombre cliente",
                              "nif": "A15022510",
                              "desglose": {
                                "no_exenta": {
                                  "tipo_no_exenta": "S1",
                                  "detalle_iva": [
                                    {
                                      "tipo_impositivo": "21",
                                      "base_imponible": "200",
                                      "cuota_repercutida": "42"
                                    }
                                  ]
                                }
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/modify"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .method("PUT", HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE"",
              ""tipo_factura"": ""F1"",
              ""clave_regimen"": [
                ""01""
              ],
              ""descripcion"": ""Factura normal (descripción corregida)"",
              ""nombre"": ""Nombre cliente"",
              ""nif"": ""A15022510"",
              ""desglose"": {
                ""no_exenta"": {
                  ""tipo_no_exenta"": ""S1"",
                  ""detalle_iva"": [
                    {
                      ""tipo_impositivo"": ""21"",
                      ""base_imponible"": ""200"",
                      ""cuota_repercutida"": ""42""
                    }
                  ]
                }
              },
              ""importe_total"": ""242""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PutAsync("https://api.verifacti.com/sii/modify", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/modify"

            oHttp.Open "PUT", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf
            sBody = sBody & "  ""tipo_factura"": ""F1""," & vbCrLf
            sBody = sBody & "  ""clave_regimen"": [" & vbCrLf
            sBody = sBody & "    ""01""" & vbCrLf
            sBody = sBody & "  ]," & vbCrLf
            sBody = sBody & "  ""descripcion"": ""Factura normal (descripción corregida)""," & vbCrLf
            sBody = sBody & "  ""nombre"": ""Nombre cliente""," & vbCrLf
            sBody = sBody & "  ""nif"": ""A15022510""," & vbCrLf
            sBody = sBody & "  ""desglose"": {" & vbCrLf
            sBody = sBody & "    ""no_exenta"": {" & vbCrLf
            sBody = sBody & "      ""tipo_no_exenta"": ""S1""," & vbCrLf
            sBody = sBody & "      ""detalle_iva"": [" & vbCrLf
            sBody = sBody & "        {" & vbCrLf
            sBody = sBody & "          ""tipo_impositivo"": ""21""," & vbCrLf
            sBody = sBody & "          ""base_imponible"": ""200""," & vbCrLf
            sBody = sBody & "          ""cuota_repercutida"": ""42""" & vbCrLf
            sBody = sBody & "        }" & vbCrLf
            sBody = sBody & "      ]" & vbCrLf
            sBody = sBody & "    }" & vbCrLf
            sBody = sBody & "  }," & vbCrLf
            sBody = sBody & "  ""importe_total"": ""242""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          description: Optional unique key to make sure retries of the same request do not create duplicates. Printable ASCII string of 1 to 255 characters. Remembered for 24 hours per NIF.
          schema:
            type: string
            pattern: ^[\x20-\x7E]{1,255}$
            minLength: 1
            maxLength: 255
            example: 8e1b9c2a-3f4d-4a6b-9c2e-1d2f3e4a5b6c
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Factura"
            examples:
              modificar:
                summary: Modify an invoice
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  serie: A
                  numero: "1"
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  clave_regimen:
                    - "01"
                  descripcion: Factura normal (descripción corregida)
                  nombre: Nombre cliente
                  nif: A15022510
                  desglose:
                    no_exenta:
                      tipo_no_exenta: S1
                      detalle_iva:
                        - tipo_impositivo: "21"
                          base_imponible: "200"
                          cuota_repercutida: "42"
                  importe_total: "242"
      responses:
        "200":
          description: Valid modification, queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier, to check its status.
                    type: string
                    example: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
                  estado:
                    description: "Always <code>Pendiente</code>: the record is queued."
                    type: string
                    example: Pendiente
        "400":
          description: Error in the request data. The record is not created and nothing is sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description.
                    type: string
                    example: La cuota_repercutida debe ser base_imponible (o base_imponible_a_coste con la clave 06) por tipo_impositivo / 100, con un margen de 10 euros.
                  codigo:
                    description: Stable error identifier. Full catalogue <a href="https://www.verifacti.com/openapi/codigos-sii.yaml" target="_blank">here</a>.
                    type: string
                    example: vf-sii-cuota_repercutida_calculo
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "500":
          description: Server error. The record is not created; retry later.
  /sii/cancel:
    post:
      summary: Cancel invoice
      description: |-
        Cancels an invoice the AEAT has registered, through an SII cancellation (baja) record. <code>ejercicio</code> and <code>periodo</code> must be those of the original registration, or of the last modification if there was one. The result will be <code>Anulado</code>, or <code>Factura inexistente</code> if the AEAT doesn't have the invoice.

        This endpoint also accepts an optional `Idempotency-Key` header. If included, retries of the same logical request with the same key replay the original response (including the `Idempotent-Replayed: true` response header and the echoed `Idempotency-Key`). Keys are bound to the NIF and remembered for 24 hours. Reusing the same key with a different body returns 422; a concurrent retry while the first one is still in progress returns 409. See the "Idempotency" section at the start of this documentation for details.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request POST 'https://api.verifacti.com/sii/cancel' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE"
            }'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/cancel'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/cancel';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE"
            };

            const response = await axios.post("https://api.verifacti.com/sii/cancel", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/cancel";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH",
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\",\n  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/cancel\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH",
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/cancel"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH"",
              ""serie"": ""A"",
              ""numero"": ""1"",
              ""fecha_expedicion"": ""CURRENT_DATE""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/cancel", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/cancel"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""," & vbCrLf
            sBody = sBody & "  ""serie"": ""A""," & vbCrLf
            sBody = sBody & "  ""numero"": ""1""," & vbCrLf
            sBody = sBody & "  ""fecha_expedicion"": ""CURRENT_DATE""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          description: Optional unique key to make sure retries of the same request do not create duplicates. Printable ASCII string of 1 to 255 characters. Remembered for 24 hours per NIF.
          schema:
            type: string
            pattern: ^[\x20-\x7E]{1,255}$
            minLength: 1
            maxLength: 255
            example: 8e1b9c2a-3f4d-4a6b-9c2e-1d2f3e4a5b6c
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - ejercicio
                - periodo
                - serie
                - numero
                - fecha_expedicion
              properties:
                ejercicio:
                  type: string
                  description: Year of the tax period of the original record (or of its last modification).
                  example: CURRENT_YEAR
                periodo:
                  type: string
                  enum:
                    - "01"
                    - "02"
                    - "03"
                    - "04"
                    - "05"
                    - "06"
                    - "07"
                    - "08"
                    - "09"
                    - "10"
                    - "11"
                    - "12"
                    - 1T
                    - 2T
                    - 3T
                    - 4T
                  description: Tax period of the original record (or of its last modification). It cannot be later than the current period.
                  example: CURRENT_MONTH
                serie:
                  type: string
                  description: Invoice series. May be empty. Together with the number, at most 60 characters.
                  example: A
                numero:
                  type: string
                  description: Invoice number. In a summary entry (F4), the first one of the range.
                  example: "1"
                fecha_expedicion:
                  type: string
                  description: Issue date of the invoice. Format DD-MM-YYYY.
                  example: CURRENT_DATE
            example:
              ejercicio: CURRENT_YEAR
              periodo: CURRENT_MONTH
              serie: A
              numero: "1"
              fecha_expedicion: CURRENT_DATE
      responses:
        "200":
          description: Valid cancellation, queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier, to check its status.
                    type: string
                    example: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
                  estado:
                    description: "Always <code>Pendiente</code>: the record is queued."
                    type: string
                    example: Pendiente
        "400":
          description: Error in the request data. The record is not created and nothing is sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description.
                    type: string
                    example: El ejercicio y el periodo de la baja no pueden ser posteriores al periodo actual.
                  codigo:
                    description: Stable error identifier. Full catalogue <a href="https://www.verifacti.com/openapi/codigos-sii.yaml" target="_blank">here</a>.
                    type: string
                    example: vf-sii-baja_periodo_futuro
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "500":
          description: Server error. The record is not created; retry later.
  /sii/list:
    post:
      summary: List invoices
      description: |-
        Queries the AEAT for the book's invoices of a tax period and returns those sent from this Verifacti NIF.
        <ul style="list-style: disc;">
          <li>Each invoice comes with the names of <code>/sii/create</code>, except <code>num_serie</code>: the AEAT returns series and number together.</li>
          <li>The <code>uuid</code> is that of the last record sent for that invoice (registration, modification or cancellation).</li>
          <li>Amounts come as the AEAT stores them, without trailing zeros (<code>242</code> instead of <code>242.00</code>).</li>
          <li>The AEAT returns up to 10,000 invoices per page. If <code>paginacion</code> is <code>S</code>, ask for the next page with the same <code>ejercicio</code> and <code>periodo</code> and the <code>token</code> you received.</li>
        </ul>
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request POST 'https://api.verifacti.com/sii/list' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/list'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/list';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            };

            const response = await axios.post("https://api.verifacti.com/sii/list", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/list";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/list\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/list"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/list", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/list"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - ejercicio
                - periodo
              properties:
                ejercicio:
                  type: string
                  description: Year of the tax period in which the invoice is reported (4 digits).
                  example: CURRENT_YEAR
                periodo:
                  type: string
                  enum:
                    - "01"
                    - "02"
                    - "03"
                    - "04"
                    - "05"
                    - "06"
                    - "07"
                    - "08"
                    - "09"
                    - "10"
                    - "11"
                    - "12"
                    - 1T
                    - 2T
                    - 3T
                    - 4T
                  description: "Tax period: 01 to 12 or 1T to 4T."
                  example: CURRENT_MONTH
                token:
                  type: string
                  description: Token of the previous page, to ask for the next one.
            examples:
              listar:
                summary: First page
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
              listar_siguiente:
                summary: Next page
                value:
                  ejercicio: CURRENT_YEAR
                  periodo: CURRENT_MONTH
                  token: TOKEN_DE_LA_PAGINA_ANTERIOR
      responses:
        "200":
          description: Invoices of the period
          content:
            application/json:
              schema:
                type: object
                properties:
                  paginacion:
                    type: string
                    enum:
                      - S
                      - "N"
                    description: S if there are more pages.
                    example: "N"
                  token:
                    type: string
                    nullable: true
                    description: Token to ask for the next page, or null.
                    example: null
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/RegistroLibro"
        "400":
          description: Error in the request data. The record is not created and nothing is sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description.
                    type: string
                    example: ejercicio (4 digitos) y periodo (01-12, 1T-4T o 0A) son requeridos
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
        "502":
          description: The AEAT query could not be completed. Try again in a few minutes.
  /sii/export:
    post:
      summary: Export XMLs
      description: Returns signed URLs to download the XMLs sent to the AEAT in a month of submission (each submission with its response, <code>_req.xml</code> and <code>_res.xml</code>). URLs expire after 15 minutes. 500 are returned per page; if <code>token</code> is not null, use it to ask for the next one. <code>ejercicio</code> and <code>periodo</code> are the year and month of submission, not the tax period.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request POST 'https://api.verifacti.com/sii/export' \
            --header 'Authorization: Bearer <API_KEY>' \
            --header 'Content-Type: application/json' \
            --data '{
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }'
        - lang: Python
          label: Python
          source: |
            import requests
            url = 'https://api.verifacti.com/sii/export'
            headers = {
              'Authorization': 'Bearer <API_KEY>'
            }
            data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }
            response = requests.post(url, headers=headers, json=data)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const url = 'https://api.verifacti.com/sii/export';
            const headers = {
              'Authorization': 'Bearer <API_KEY>',
              'Content-Type': 'application/json'
            };
            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            };
            fetch(url, { headers, method: 'POST', body: JSON.stringify(data) })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            };

            const response = await axios.post("https://api.verifacti.com/sii/export", data, {
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              }
            });

            console.log(response.data);
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $url = "https://api.verifacti.com/sii/export";

            $headers = [
                "Authorization: Bearer <API_KEY>",
                "Content-Type: application/json"
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $body = <<<'JSON'
            {
              "ejercicio": "CURRENT_YEAR",
              "periodo": "CURRENT_MONTH"
            }
            JSON;

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\tbody := `\n{\n  \"ejercicio\": \"CURRENT_YEAR\",\n  \"periodo\": \"CURRENT_MONTH\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/sii/export\", strings.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer <API_KEY>\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(\"Status:\", resp.StatusCode)\n\tfmt.Println(string(respBody))\n}"
        - lang: Java
          label: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    HttpClient client = HttpClient.newHttpClient();

                    String body = """
                            {
                              "ejercicio": "CURRENT_YEAR",
                              "periodo": "CURRENT_MONTH"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/sii/export"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString());

                    System.out.println(response.statusCode());
                    System.out.println(response.body());
                }
            }
        - lang: C#
          label: C#
          source: |-
            using System;
            using System.Net.Http;
            using System.Text;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main()
                {
                    using var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var body = @"
            {
              ""ejercicio"": ""CURRENT_YEAR"",
              ""periodo"": ""CURRENT_MONTH""
            }
            ";

                    var content = new StringContent(body, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync("https://api.verifacti.com/sii/export", content);

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6
          source: |-
            Dim oHttp As Object
            Dim sUrl As String
            Dim sResponse As String
            Dim sBody As String

            Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")

            sUrl = "https://api.verifacti.com/sii/export"

            oHttp.Open "POST", sUrl, False
            oHttp.setRequestHeader "Authorization", "Bearer <API_KEY>"
            oHttp.setRequestHeader "Content-Type", "application/json"

            sBody = ""
            sBody = sBody & "{" & vbCrLf
            sBody = sBody & "  ""ejercicio"": ""CURRENT_YEAR""," & vbCrLf
            sBody = sBody & "  ""periodo"": ""CURRENT_MONTH""" & vbCrLf
            sBody = sBody & "}" & vbCrLf

            oHttp.send sBody

            sResponse = oHttp.responseText
            Debug.Print "Status: " & oHttp.Status
            Debug.Print sResponse

            Set oHttp = Nothing
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - ejercicio
                - periodo
              properties:
                ejercicio:
                  type: string
                  description: Year of submission.
                  example: CURRENT_YEAR
                periodo:
                  type: string
                  description: Month of submission, 1 to 12.
                  example: CURRENT_MONTH
                token:
                  type: string
                  description: Token of the previous page.
            example:
              ejercicio: CURRENT_YEAR
              periodo: CURRENT_MONTH
      responses:
        "200":
          description: Download URLs
          content:
            application/json:
              schema:
                type: object
                properties:
                  urls:
                    type: array
                    items:
                      type: string
                    description: Signed XML URLs.
                  token:
                    type: string
                    nullable: true
                    description: Token for the next page, or null.
                    example: null
        "400":
          description: ejercicio or periodo is missing, or periodo is not a month.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/NifInactivo"
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key.
    NifInactivo:
      description: The NIF linked to the API key is deactivated. The request is not processed.
  schemas:
    Factura:
      type: object
      required:
        - ejercicio
        - periodo
        - serie
        - numero
        - fecha_expedicion
        - tipo_factura
        - clave_regimen
        - descripcion
        - desglose
      properties:
        ejercicio:
          type: string
          description: Year of the tax period in which the invoice is reported (4 digits).
          example: CURRENT_YEAR
        periodo:
          type: string
          enum:
            - "01"
            - "02"
            - "03"
            - "04"
            - "05"
            - "06"
            - "07"
            - "08"
            - "09"
            - "10"
            - "11"
            - "12"
            - 1T
            - 2T
            - 3T
            - 4T
          description: "Tax period: a month (01 to 12) or, for quarterly filers, a quarter (1T to 4T). You set it: it is not derived from the dates. It cannot be later than the current period, except with keys 14 and 15."
          example: CURRENT_MONTH
        serie:
          type: string
          description: Invoice series. May be empty. Together with the number, at most 60 characters.
          example: A
        numero:
          type: string
          description: Invoice number.
          example: "1"
        numero_fin:
          type: string
          description: "Only in summary entries (F4), and required there: number of the last invoice of the range, in the same series."
          example: "50"
        fecha_expedicion:
          type: string
          description: Issue date. It cannot be later than today or earlier than 20 years ago. Format DD-MM-YYYY.
          example: CURRENT_DATE
        tipo_factura:
          type: string
          enum:
            - F1
            - F2
            - F3
            - F4
            - R1
            - R2
            - R3
            - R4
            - R5
          description: "Invoice type:<ul style=\"list-style: disc;\"><li>F1: full invoice</li><li>F2: simplified invoice</li><li>F3: invoice replacing simplified invoices</li><li>F4: summary entry of invoices</li><li>R1: corrective (error founded in law and art. 80 One, Two and Six LIVA)</li><li>R2: corrective (art. 80.3)</li><li>R3: corrective (art. 80.4)</li><li>R4: corrective (other)</li><li>R5: corrective of simplified invoices</li></ul>"
          example: F1
        tipo_rectificativa:
          type: string
          enum:
            - S
            - I
          description: "Required in corrective invoices (R1 to R5), and only there: S by substitution, I by differences."
        facturas_rectificadas:
          type: array
          description: Invoices being corrected. Only in corrective invoices (R1 to R5) and summary entries (F4).
          items:
            type: object
            required:
              - serie
              - numero
              - fecha_expedicion
            properties:
              serie:
                type: string
                description: Invoice series (may be empty).
              numero:
                type: string
                description: Invoice number.
              fecha_expedicion:
                type: string
                description: Issue date. Format DD-MM-YYYY.
                example: CURRENT_DATE
        facturas_sustituidas:
          type: array
          description: Simplified invoices that this invoice replaces. Only in F3.
          items:
            type: object
            required:
              - serie
              - numero
              - fecha_expedicion
            properties:
              serie:
                type: string
                description: Invoice series (may be empty).
              numero:
                type: string
                description: Invoice number.
              fecha_expedicion:
                type: string
                description: Issue date. Format DD-MM-YYYY.
                example: CURRENT_DATE
        importe_rectificativa:
          type: object
          required:
            - base_rectificada
            - cuota_rectificada
          description: Amounts of the corrected invoice. Required with <code>tipo_rectificativa</code> S; also allowed in F4.
          properties:
            base_rectificada:
              type: string
              description: Corrected taxable base. Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "200"
            cuota_rectificada:
              type: string
              description: Corrected tax amount. Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "42"
            cuota_recargo_rectificada:
              type: string
              description: Corrected equivalence surcharge amount. Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "10.4"
        fecha_operacion:
          type: string
          description: Transaction date, if different from the issue date. It can only be later than the issue date (or today) with keys 14 and 15. Format DD-MM-YYYY.
          example: CURRENT_DATE
        clave_regimen:
          type: array
          minItems: 1
          maxItems: 3
          description: "Special regime or relevance keys of the invoice, 1 to 3: the first one is the main key. Not every combination is valid (for example, 01 only admits 02 as an additional key). Values:<ul style=\"list-style: disc;\"><li>01: General regime transaction</li><li>02: Export</li><li>03: Special scheme for second-hand goods, works of art, antiques and collectors' items</li><li>04: Special scheme for investment gold</li><li>05: Special scheme for travel agencies</li><li>06: Special scheme for VAT groups (advanced level)</li><li>07: Special cash accounting scheme</li><li>08: Transactions subject to IPSI or IGIC</li><li>09: Services of travel agencies acting as intermediaries in the name and on behalf of others</li><li>10: Collections on behalf of third parties</li><li>11: Business premises rental subject to withholding</li><li>12: Business premises rental not subject to withholding</li><li>13: Business premises rental partly subject to withholding</li><li>14: Invoice with VAT not yet accrued in works certifications for a public administration</li><li>15: Invoice with VAT not yet accrued in continuous supplies</li><li>16: First half of 2017 and invoices prior to joining the SII</li><li>17: Transaction under one of the schemes of Chapter XI of Title IX (OSS and IOSS)</li></ul>"
          items:
            type: string
            enum:
              - "01"
              - "02"
              - "03"
              - "04"
              - "05"
              - "06"
              - "07"
              - "08"
              - "09"
              - "10"
              - "11"
              - "12"
              - "13"
              - "14"
              - "15"
              - "16"
              - "17"
          example:
            - "01"
        importe_total:
          type: string
          description: Invoice total amount. Required with keys 03, 05 and 09, and in F2, F4 and R5 with a single line of base 0. If you send it, the AEAT checks it against the breakdown (within 10 €). Number with up to 12 integer digits and 2 decimals, separated by a point.
          example: "242"
        base_imponible_a_coste:
          type: string
          description: Taxable base at cost. Required with key 06, and only with it. Number with up to 12 integer digits and 2 decimals, separated by a point.
          example: "150"
        descripcion:
          type: string
          maxLength: 500
          description: Description of the transaction (up to 500 characters).
          example: Factura normal
        importe_transmision_inmuebles_sujeto_iva:
          type: string
          description: Amount of the transfer of real estate subject to VAT. Requires identifying the counterparty. Number with up to 12 integer digits and 2 decimals, separated by a point.
          example: "1000"
        inmuebles:
          type: array
          maxItems: 15
          description: Rented properties, 1 to 15. Required with keys 12 and 13, and only with them.
          items:
            type: object
            required:
              - situacion
            properties:
              situacion:
                type: string
                enum:
                  - "1"
                  - "2"
                  - "3"
                  - "4"
                description: "1: with cadastral reference in Spain except the Basque Country and Navarre. 2: in the Basque Country or Navarre. 3: without cadastral reference, in any of the above. 4: abroad."
              referencia_catastral:
                type: string
                maxLength: 25
                description: Cadastral reference. Required except with situation 3 or 4.
                example: 9872023VH5797S0001WX
        nombre:
          type: string
          maxLength: 120
          description: Name or company name of the counterparty. The counterparty is required in F1, F3 and R1 to R4, and not allowed in F2, F4 and R5.
          example: Nombre cliente
        nif:
          type: string
          description: Spanish NIF of the counterparty. Send <code>nif</code> or <code>id_otro</code>, not both.
          example: A15022510
        id_otro:
          type: object
          required:
            - id_type
            - id
          description: Identification of a counterparty without a Spanish NIF.
          properties:
            codigo_pais:
              type: string
              description: ISO 3166-1 alpha-2 country code. Required except with <code>id_type</code> 02; with 07 it must be ES.
              example: US
            id_type:
              type: string
              enum:
                - "02"
                - "03"
                - "04"
                - "05"
                - "06"
                - "07"
              description: "02: VAT number. 03: passport. 04: official identity document of the country of residence. 05: residence certificate. 06: other supporting document. 07: not registered (individual with a Spanish NIF not in the census; the country must be ES)."
            id:
              type: string
              maxLength: 20
              description: Identification number (up to 20 characters). With 02, the full VAT number with the country prefix.
              example: BE0404621642
        nif_representante:
          type: string
          description: NIF of the counterparty's representative, if any.
        validar_destinatario:
          type: boolean
          default: true
          description: If you send <code>nif</code>, by default we check that the counterparty is in the AEAT census, and with <code>id_otro</code> of type 02 that the VAT number is in the VIES census, because otherwise the AEAT rejects the invoice. This requires an extra call on our side. You can turn these checks off in the test environment by setting this field to <code>false</code>; in production they always run.
        especial:
          type: object
          description: Special-case flags.
          properties:
            cupon:
              type: string
              enum:
                - S
                - "N"
              description: Coupon. Only in R1, R5 and F4 (other types refuse it, even with N).
            factura_simplificada_art_7273:
              type: string
              enum:
                - S
                - "N"
              description: Qualified simplified invoice (arts. 7.2 and 7.3 of the invoicing regulation). S only in F1, F3 and R1 to R4.
            factura_sin_identif_destinatario_art_61d:
              type: string
              enum:
                - S
                - "N"
              description: Invoice without identification of the recipient (art. 6.1.d). S only in F2, F4 and R5.
            macrodato:
              type: string
              enum:
                - S
                - "N"
              description: Required with S if the total amount is ±100,000,000 € or more, and only then.
            emitida_por_tercero_o_destinatario:
              type: string
              enum:
                - S
                - "N"
              description: S if the invoice is actually issued by a third party or by the recipient. It cannot be S together with <code>facturacion_mercado_organizado_gas</code>.
            varios_destinatarios:
              type: string
              enum:
                - S
                - "N"
              description: "S if the invoice has several recipients: the SII takes a single counterparty, so one of them is identified."
            num_registro_acuerdo_facturacion:
              type: string
              maxLength: 15
              description: Registration number of the invoicing agreement (up to 15 characters).
            entidad_sucedida:
              type: object
              required:
                - nombre
                - nif
              description: Predecessor entity, after a restructuring.
              properties:
                nombre:
                  type: string
                  maxLength: 120
                  description: Name or company name.
                nif:
                  type: string
                  description: NIF.
            reg_previo_ggee_redeme_competencia:
              type: string
              enum:
                - S
                - "N"
              description: Prior registration in the VAT group, the REDEME or competition.
            facturacion_mercado_organizado_gas:
              type: string
              enum:
                - S
                - "N"
              description: Invoicing under additional provisions three and six and of the organised gas market.
            hidrocarburos_extraidos_deposito:
              type: string
              enum:
                - S
                - "N"
              description: Hydrocarbons removed from a tax warehouse.
        desglose:
          $ref: "#/components/schemas/Desglose"
    Desglose:
      type: object
      description: "Invoice breakdown, with the SII's structure. It has two forms, told apart by their keys:<ul style=\"list-style: disc;\"><li><strong>Plain</strong>: <code>exenta</code>, <code>no_exenta</code> and/or <code>no_sujeta</code> directly in <code>desglose</code>.</li><li><strong>By type of transaction</strong>: <code>entrega</code> (supply of goods) and/or <code>prestacion_servicios</code>, each with its own <code>exenta</code>, <code>no_exenta</code> and <code>no_sujeta</code>.</li></ul>The by-transaction form is required when the counterparty is identified with <code>id_otro</code> or with a NIF starting with N, except in F2 and F4. In every other case either form is accepted. The two forms cannot be mixed."
      properties:
        exenta:
          type: array
          maxItems: 7
          description: Subject and exempt part, 1 to 7 details.
          items:
            type: object
            required:
              - base_imponible
            properties:
              causa_exencion:
                type: string
                enum:
                  - E1
                  - E2
                  - E3
                  - E4
                  - E5
                  - E6
                description: "Exemption cause: E1 (art. 20 LIVA), E2 (art. 21, exports), E3 (art. 22), E4 (arts. 23 and 24), E5 (art. 25, intra-EU supplies), E6 (other)."
              base_imponible:
                type: string
                description: Exempt taxable base. Number with up to 12 integer digits and 2 decimals, separated by a point.
                example: "200"
        no_exenta:
          type: object
          required:
            - tipo_no_exenta
            - detalle_iva
          description: Subject and non-exempt part.
          properties:
            tipo_no_exenta:
              type: string
              enum:
                - S1
                - S2
                - S3
              description: "S1: without reverse charge. S2: with reverse charge (rate and amount 0). S3: with and without reverse charge (at least one line with rate 0)."
            detalle_iva:
              type: array
              minItems: 1
              maxItems: 12
              description: 1 to 12 lines, one per VAT rate.
              items:
                $ref: "#/components/schemas/DetalleIVA"
        no_sujeta:
          type: object
          description: Part not subject to VAT. At least one of the two amounts.
          properties:
            importe_por_articulos_7_14_otros:
              type: string
              description: Amount not subject under articles 7 and 14 of the LIVA and others. Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "200"
            importe_tai_reglas_localizacion:
              type: string
              description: Amount not subject under place-of-supply rules (transactions taxed outside the territory where the tax applies). Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "200"
        entrega:
          $ref: "#/components/schemas/BloqueDesglose"
        prestacion_servicios:
          $ref: "#/components/schemas/BloqueDesglose"
    BloqueDesglose:
      type: object
      description: At least one of <code>exenta</code>, <code>no_exenta</code> or <code>no_sujeta</code>.
      properties:
        exenta:
          type: array
          maxItems: 7
          description: Subject and exempt part, 1 to 7 details.
          items:
            type: object
            required:
              - base_imponible
            properties:
              causa_exencion:
                type: string
                enum:
                  - E1
                  - E2
                  - E3
                  - E4
                  - E5
                  - E6
                description: "Exemption cause: E1 (art. 20 LIVA), E2 (art. 21, exports), E3 (art. 22), E4 (arts. 23 and 24), E5 (art. 25, intra-EU supplies), E6 (other)."
              base_imponible:
                type: string
                description: Exempt taxable base. Number with up to 12 integer digits and 2 decimals, separated by a point.
                example: "200"
        no_exenta:
          type: object
          required:
            - tipo_no_exenta
            - detalle_iva
          description: Subject and non-exempt part.
          properties:
            tipo_no_exenta:
              type: string
              enum:
                - S1
                - S2
                - S3
              description: "S1: without reverse charge. S2: with reverse charge (rate and amount 0). S3: with and without reverse charge (at least one line with rate 0)."
            detalle_iva:
              type: array
              minItems: 1
              maxItems: 12
              description: 1 to 12 lines, one per VAT rate.
              items:
                $ref: "#/components/schemas/DetalleIVA"
        no_sujeta:
          type: object
          description: Part not subject to VAT. At least one of the two amounts.
          properties:
            importe_por_articulos_7_14_otros:
              type: string
              description: Amount not subject under articles 7 and 14 of the LIVA and others. Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "200"
            importe_tai_reglas_localizacion:
              type: string
              description: Amount not subject under place-of-supply rules (transactions taxed outside the territory where the tax applies). Number with up to 12 integer digits and 2 decimals, separated by a point.
              example: "200"
    DetalleIVA:
      type: object
      required:
        - base_imponible
      properties:
        tipo_impositivo:
          type: string
          description: "VAT rate in %: 0, 4, 10 or 21 (5, 2 and 7.5 only for the dates and cases in which they applied; 7, 8, 16 and 18 for transactions up to 2012)."
          example: "21"
        base_imponible:
          type: string
          description: Taxable base. Number with up to 12 integer digits and 2 decimals, separated by a point.
          example: "200"
        cuota_repercutida:
          type: string
          description: "Output VAT: taxable base × rate / 100, within 10 €. Required when the rate is not 0 (except in F4 and R5). Number with up to 12 integer digits and 2 decimals, separated by a point."
          example: "42"
        tipo_recargo_equivalencia:
          type: string
          description: "Equivalence surcharge rate in %. It goes with the VAT rate: 21 → 5.2 or 1.75; 10 → 1.4; 4 → 0.5. Not allowed in <code>prestacion_servicios</code>."
          example: "5.2"
        cuota_recargo_equivalencia:
          type: string
          description: Equivalence surcharge amount. Not allowed in <code>prestacion_servicios</code>. Number with up to 12 integer digits and 2 decimals, separated by a point.
          example: "10.4"
    RegistroLibro:
      type: object
      description: A record of the book, with the names of <code>/sii/create</code>.
      properties:
        uuid:
          type: string
          description: uuid of the last record Verifacti sent for this invoice (registration, modification or cancellation).
        num_serie:
          type: string
          description: Series and number together, as the AEAT returns them.
        num_serie_fin:
          type: string
          description: In summary entries (F4), series and number of the last invoice.
        fecha_expedicion:
          type: string
        tipo_factura:
          type: string
        clave_regimen:
          type: array
          items:
            type: string
        importe_total:
          type: string
        descripcion:
          type: string
        nombre:
          type: string
        nif:
          type: string
        id_otro:
          type: object
        especial:
          type: object
        desglose:
          type: object
        estado:
          type: string
          enum:
            - Correcta
            - AceptadaConErrores
            - Anulada
          description: State of the invoice in the AEAT book.
        codigo_error:
          type: string
        mensaje_error:
          type: string
        estado_cuadre:
          type: string
          description: Matching state with the counterparty's information, 1 to 5, if the AEAT reports it.
        fecha_presentacion:
          type: string
          description: Submission date and time (DD-MM-YYYY hh:mm:ss).
        ultima_modificacion:
          type: string
          description: Date and time of the last change in the book.
      example:
        uuid: ea6eae92-bac6-48c3-baa4-2bbf6b5ee562
        num_serie: A1
        fecha_expedicion: CURRENT_DATE
        tipo_factura: F1
        clave_regimen:
          - "01"
        importe_total: "242"
        descripcion: Factura normal
        nombre: Nombre cliente
        nif: A15022510
        especial:
          emitida_por_tercero_o_destinatario: "N"
          varios_destinatarios: "N"
        desglose:
          no_exenta:
            tipo_no_exenta: S1
            detalle_iva:
              - tipo_impositivo: "21"
                base_imponible: "200"
                cuota_repercutida: "42"
        estado: Correcta
        fecha_presentacion: CURRENT_DATE 10:04:07
        ultima_modificacion: CURRENT_DATE 10:04:07
