openapi: 3.0.3
servers:
  - url: https://api.verifacti.com/
info:
  title: Verifactu 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 invoices to the Agencia Estatal de Administración Tributaria (AEAT) in accordance
    with the Verifactu system.

    &nbsp;

    We also have an API to comply with the TicketBai requirements, the equivalent of Verifactu in the Basque Country. It is a
    separate API but with a completely analogous structure. The documentation can be found <a href="https://www.verifacti.com/tb-docs">here</a>.

    &nbsp;

    Additionally, we have created a third 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/nifs-docs">here</a>. This API is included in the price and can be used by any user
    with an active subscription.

    &nbsp;

    <div style="display: flex; justify-content: start;">

    <a
      href="https://storage.googleapis.com/verifacti_non_sensitive/postman_verifactu.json"
      download="docs.json"
      style="
      display: inline-block;
      padding: 6px 12px;
      background-color: #FF6C37;
      color: white;
      text-decoration: none;
      border-radius: 5px;
      font-weight: bold;
      font-family: Arial, sans-serif;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    ">
      Postman Collection
    </a>

    <a
      href="https://storage.googleapis.com/verifacti_non_sensitive/ejecutables.zip"
      download="ejecutables.zip"
      style="
      margin-left: 10px;
      color: #333333;
      display: inline-block;
      padding: 6px 12px;
      text-decoration: none;
      border-radius: 5px;
      font-weight: bold;
      font-family: Arial, sans-serif;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    ">
      Windows Executables
    </a>

    </div>

    # Comparison between the AEAT API and the Verifacti API

    The API that the Agencia Estatal de Administración Tributaria (AEAT) has made available to taxpayers for submitting invoices
    requires following these steps:

    &nbsp;

    <ol style="list-style: decimal;">
      <li>Create a digital fingerprint using the invoice data and the taxpayer's NIF.</li>
      <li>Compose an XML file with the invoice data, the fingerprint, and the fingerprint of the previous submission.</li>
      <li>Send said XML file to the AEAT via an authenticated call using a qualified recognized electronic certificate.</li>
      <li>Manage submissions according to the protocol established by the AEAT. That is, no more than one call per minute, unless more than 1000 submissions accumulate.</li>
      <li>In parallel, a QR code containing the invoice verification URL must be generated for inclusion in the invoice delivered to the recipient.</li>
      <li>Store the data of each invoice.</li>
    </ol>

    &nbsp;

    Using our Verifactu API, all these steps are simplified into a single step:

    &nbsp;

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

    &nbsp;

    Our API responds immediately with the QR code so you can add it directly to the invoice. We take care of
    the fingerprint, the XML files, the QR code, the authenticated call, the queues and wait times, and the storage of the invoices.

    &nbsp;

    At any time you can check the status of all your submissions and invoices via API. Additionally, you will have a simple dashboard
    for more convenient access. This can be especially useful when performing initial testing and integration. There
    you will also find examples of the different API calls and even a terminal so you can test without the need to use
    POSTMAN, for example.


    # Basic operation

    The AEAT has a test environment, and since July 2025 the production environment has been available.
    The Verifacti API similarly has a test environment and a production environment.
    Therefore, in both cases, the Verifacti API communicates with the AEAT in the corresponding environment to make submissions.

    &nbsp;

    When registering a NIF in our dashboard, an API key (test or production) will be generated, which you must include in the `Authorization` header for
    any call. This way, the issuer's NIF and the environment are determined by the API key being used.

    &nbsp;    

    To create an invoice, make a call to the POST `/create` endpoint with the invoice data in the request body, in JSON format.
    The response to this call consists of the QR code, the fingerprint, and a unique identifier to check the status of the invoice record.

    &nbsp;

    Since the AEAT does not allow submitting invoices in real time, the invoicing record is queued and processed in approximately one minute.
    Processing the invoice consists of sending the generated XML to the AEAT and, if there are no errors, updating the invoice status in our system.
    At any time, you can check both the status of the invoicing record and the status of the invoice in our system.

    Modification and cancellation records follow the same queuing process.

    &nbsp;

    When you create your free account, you will be provided with a test NIF and examples to make the different API calls.

    # Idempotency

    The mutation endpoints (`/create`, `/create_bulk`, `/modify` and `/cancel`) accept an optional
    `Idempotency-Key` header for safe retries after a network failure. The key is a printable ASCII
    string of 1 to 255 characters and remembered for 24 hours per NIF. Full details and the relevant error codes (`400`, `409`, `422`) are documented
    on each affected endpoint.
paths:
  /verifactu/health:
    get:
      summary: API Status
      description: |
        This endpoint returns the status of the API key. It is primarily used to verify that the API is active and to know which NIF and environment it refers to.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X GET 'https://api.verifacti.com/verifactu/health' \
              -H 'Authorization: Bearer <API_KEY>'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/health"

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

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

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const response = await fetch("https://api.verifacti.com/verifactu/health", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              }
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

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

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

            $url = "https://api.verifacti.com/verifactu/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/verifactu/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/verifactu/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.Text;
            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/verifactu/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/verifactu/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: Taxpayer's NIF.
                    type: string
                    example: B75777847
                  entorno:
                    description: API key environment.
                    type: string
                    example: test
  /verifactu/status:
    post:
      summary: Invoice status
      description: |
        This endpoint allows you to check the status of an invoice in the AEAT system.

        &nbsp;

        Invoices not registered with the AEAT will not appear here.
        To check the status of invoicing records not yet processed or rejected by the AEAT, use the GET `/status` endpoint.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/status' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "234634",
                   "fecha_expedicion": "CURRENT_DATE"
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/status"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/status", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/status", 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/verifactu/status";

            $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'
            {
              "serie": "A",
              "numero": "234634",
              "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  \"serie\": \"A\",\n  \"numero\": \"234634\",\n  \"fecha_expedicion\": \"CURRENT_DATE\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/status\", 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 = """
                            {
                              "serie": "A",
                              "numero": "234634",
                              "fecha_expedicion": "CURRENT_DATE"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/status"))
                        .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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""234634"",
                          ""fecha_expedicion"": ""CURRENT_DATE""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/status", 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

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

            sUrl = "https://api.verifacti.com/verifactu/status"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""234634""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""" & 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:
                - serie
                - numero
                - fecha_expedicion
              properties:
                serie:
                  type: string
                  example: A
                  description: Invoice series.
                numero:
                  type: string
                  example: '234634'
                  description: Invoice number.
                fecha_expedicion:
                  type: string
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  example: CURRENT_DATE
                  description: Invoice issue date. Cannot be a date later than the current date.
                fecha_operacion:
                  type: string
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  description: |
                    Invoice operation date. It is mandatory to include the operation date if it was included in the original billing
                    record and is different from the issue date.
      responses:
        '200':
          description: Invoice status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/estadoFactura'
        '500':
          description: Server error
    get:
      summary: Record status
      description: |
        This endpoint allows you to check the current status of a invoicing record submitted previously. Immediately after submitting a record, it is
        always in `Pendiente` (Pending) status, queued, and will typically be processed in less than a minute. This is because, in general, the AEAT does not allow submitting billing
        records in real time but requires waiting between different submissions.

        &nbsp;

        It is important to understand that, although uncommon, multiple invoicing records can exist for the same invoice. For example, an invoice created
        and subsequently cancelled would have two different invoicing records (one for creation and one for cancellation). This endpoint returns the status of the
        invoicing record, which does not necessarily correspond to the status of the invoice.

        &nbsp;

        In the test environment, invoicing record data will be stored for a maximum of 90 days.
        However, the invoice query endpoints will have historical data since they query the AEAT.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X GET 'https://api.verifacti.com/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c' \
              -H 'Authorization: Bearer <API_KEY>'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/status"

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

            params = {
                "uuid": "b018ced3-b362-4494-8776-9eefff1c160c"
            }

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

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const response = await fetch("https://api.verifacti.com/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              }
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const response = await axios.get("https://api.verifacti.com/verifactu/status", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              },
              params: {
                "uuid": "b018ced3-b362-4494-8776-9eefff1c160c"
              }
            });

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

            $url = "https://api.verifacti.com/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c";

            $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/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c\", 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/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c"))
                        .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.Text;
            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/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c");

                    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/verifactu/status?uuid=b018ced3-b362-4494-8776-9eefff1c160c"

            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
          schema:
            type: string
          example: b018ced3-b362-4494-8776-9eefff1c160c
          description: Unique record identifier received as a response at the time of submission.
      responses:
        '200':
          description: Record status
          content:
            application/json:
              schema:
                type: object
                properties:
                  nif:
                    description: NIF of the invoice issuer.
                    type: string
                  serie:
                    description: Invoice series.
                    type: string
                  numero:
                    description: Invoice number.
                    type: string
                  fecha_expedicion:
                    description: Invoice issue date.
                    type: string
                  operacion:
                    description: |
                      There are three common types of record operations:
                      <ol style="list-style: disc;">
                        <li>Alta: normal submission of an invoice. Endpoint: <code>/create</code>.</li>
                        <li>Subsanacion: normal amendment of an invoice. Endpoint: <code>/modify</code>.</li>
                        <li>Anulacion: normal cancellation of an invoice. Endpoint: <code>/cancel</code>.</li>
                      </ol>

                      There are 5 other special operations:
                      <ol style="list-style: disc;">
                        <li>Alta (rechazo previo): amendment after previous rejection. Endpoint: <code>/modify</code> with <code>rechazo_previo=X</code>.</li>
                        <li>Alta (rechazo previo de subsanacion): amendment after amendment rejection. Endpoint: <code>/modify</code> with <code>rechazo_previo=S</code>.</li>
                        <li>Anulación (rechazo previo): cancellation after previous rejection. Endpoint: <code>/cancel</code> with <code>rechazo_previo=S</code> and <code>sin_registro_previo=N</code>.</li>
                        <li>Anulación (sin registro): cancellation without registration at the AEAT. Endpoint: <code>/cancel</code> with <code>rechazo_previo=N</code> and <code>sin_registro_previo=S</code>.</li>
                        <li>Anulación (rechazo previo sin registro): submission after rejection without registration. Endpoint: <code>/cancel</code> with <code>rechazo_previo=S</code> and <code>sin_registro_previo=S</code>.</li>
                      </ol>

                      For more information, see the <a href='https://www.agenciatributaria.es/AEAT.desarrolladores/Desarrolladores/_menu_/Documentacion/Sistemas_Informaticos_de_Facturacion_y_Sistemas_VERI_FACTU/Sistemas_Informaticos_de_Facturacion_y_Sistemas_VERI_FACTU.html' target='_blank'>AEAT documentation</a>.
                    type: string
                  estado:
                    description: |
                      Invoicing record status:
                      <ol style="list-style: disc;">
                        <li>Pendiente: Record queued and not yet processed.</li>
                        <li>Correcto: Record processed correctly by the AEAT.</li>
                        <li>Aceptado con errores: Record accepted with errors by the AEAT. An amendment record or corrective invoice must be submitted.</li>
                        <li>Incorrecto: Record considered incorrect by the AEAT. An amendment record with <code>rechazo_previo=S</code> or <code>rechazo_previo=X</code> or a corrective invoice must be submitted.</li>
                        <li>Duplicado: Record not accepted by the AEAT because a record with the same (serie, numero, fecha_expedicion) already exists.</li>
                        <li>Anulado: Cancellation record processed correctly by the AEAT.</li>
                        <li>Factura inexistente: Cancellation record not accepted by the AEAT because the invoice does not exist.</li>
                        <li>No registrado: Record rejected by the AEAT.</li>
                        <li>Error servidor AEAT: Error on the AEAT server. The invoicing record will be retried.</li>
                      </ol>
                    type: string
                  url:
                    description: QR code verification URL.
                    type: string
                  qr:
                    description: Base 64 QR code containing the URL.
                    type: string
                  codigo_error:
                    description: Error code as it appears in the AEAT system.
                    type: string
                  mensaje_error:
                    description: Error description as it appears in the AEAT system.
                    type: string
                  estado_registro_duplicado:
                    description: The record status in case the record status is `Duplicado` (Duplicate).
                    type: string
                example:
                  nif: A15022510
                  serie: A
                  numero: '34547'
                  fecha_expedicion: CURRENT_DATE
                  operacion: Alta
                  url: https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=A15022510&numserie=A234634&fecha=CURRENT_DATE&importe=242
                  qr: jBBWRw0KGgoABAANSUhEAH0CAIAAABE...
                  estado: Correcto
        '404':
          description: Record not found
        '500':
          description: Server error
  /verifactu/create:
    post:
      summary: Create new invoice
      description: |
        This endpoint creates a new invoicing record. There are three response states and it is important to understand what happens in each case:
        <br><br>
        <ol style="list-style: disc;">
          <li>
            <strong>200</strong>: Our API accepts the request and queues it for processing. In this case, the response contains the base 64 QR code and the verification URL
            that contains the QR code. Additionally, the record status is returned, which will always be <code style="color: black;">Pendiente</code> (Pending), indicating it has been queued
            but not yet processed.
            <br>
            It is important to understand that this status only indicates that the invoicing record will be generated and sent to the AEAT, which does not necessarily mean that
            the AEAT will accept it. Our API performs numerous validations to minimize the risk of this happening, but it can occur.
            <br>
            The submission status can be checked with the GET <code style="color: black;">/status</code> endpoint using the returned <code style="color: black;">uuid</code>. We also provide webhooks to receive notifications about
            invoicing record statuses. The webhook documentation can be
            found <a href='https://www.verifacti.com/nifs-docs#tag/Webhooks' target='_blank'>here</a>.
            <br><br>
          </li>
          <li>
            <strong>400</strong>: Our API rejects the call due to an error in the submitted JSON. The invoicing record is not generated and no communication with the AEAT will occur.
            <br>
            We perform numerous checks to minimize the risk of the AEAT rejecting the submission. The response will include a message with the error description.
            Validations range from simple checks such as ensuring no required field is missing to more complex ones such as verifying the recipient's NIF is registered with the AEAT.
            <br><br>
          </li>
          <li>
            <strong>500</strong>: Server error. This is a generic error that should not occur. If it does, the invoicing record is not generated and,
            therefore, no submission to the AEAT is made. The client should retry the call later.  
          </li>
        </ol>

        &nbsp;

        The complete documentation for the corresponding AEAT API endpoint can be found
        <a href='https://www.agenciatributaria.es/static_files/AEAT_Desarrolladores/EEDD/IVA/VERI-FACTU/Validaciones_Errores_Veri-Factu.pdf' target='_blank'>here</a>.

        &nbsp;

        This endpoint also accepts an optional `Idempotency-Key` header. If present, 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 scoped per NIF and remembered for 24 hours.
        Reusing the same key with a different body returns 422; a concurrent retry while the first is still
        in flight returns 409.
      x-codeSamples:
        - lang: cURL
          label: cURL — Normal invoice
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Normal invoice",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python — Normal invoice
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Normal invoice",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Normal invoice
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Normal invoice",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Normal invoice
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Normal invoice",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Normal invoice",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "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 — Normal 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Normal invoice\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — Normal 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Normal invoice",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — Normal 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Normal invoice"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""importe_total"": ""242""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Normal invoice
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Normal invoice""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""242""" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F2",
                   "descripcion": "Simplified invoice",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python — Simplified invoice
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "descripcion": "Simplified invoice",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Simplified invoice
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "descripcion": "Simplified invoice",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Simplified invoice
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "descripcion": "Simplified invoice",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F2",
              "descripcion": "Simplified invoice",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F2\",\n  \"descripcion\": \"Simplified invoice\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F2",
                              "descripcion": "Simplified invoice",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F2"",
                          ""descripcion"": ""Simplified invoice"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""importe_total"": ""242""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F2""," & vbCrLf & _
                   "  ""descripcion"": ""Simplified invoice""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""242""" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Invoice with multiple VAT rates",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     },
                     {
                       "base_imponible": "100",
                       "tipo_impositivo": "10",
                       "cuota_repercutida": "10"
                     }
                   ],
                   "importe_total": "352"
                 }'
        - lang: Python
          label: Python — Multiple VAT rates
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice with multiple VAT rates",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                },
                {
                  "base_imponible": "100",
                  "tipo_impositivo": "10",
                  "cuota_repercutida": "10"
                }
              ],
              "importe_total": "352"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Multiple VAT rates
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice with multiple VAT rates",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                },
                {
                  "base_imponible": "100",
                  "tipo_impositivo": "10",
                  "cuota_repercutida": "10"
                }
              ],
              "importe_total": "352"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Multiple VAT rates
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice with multiple VAT rates",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                },
                {
                  "base_imponible": "100",
                  "tipo_impositivo": "10",
                  "cuota_repercutida": "10"
                }
              ],
              "importe_total": "352"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice with multiple VAT rates",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                },
                {
                  "base_imponible": "100",
                  "tipo_impositivo": "10",
                  "cuota_repercutida": "10"
                }
              ],
              "importe_total": "352"
            }
            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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Invoice with multiple VAT rates\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    },\n    {\n      \"base_imponible\": \"100\",\n      \"tipo_impositivo\": \"10\",\n      \"cuota_repercutida\": \"10\"\n    }\n  ],\n  \"importe_total\": \"352\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Invoice with multiple VAT rates",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                },
                                {
                                  "base_imponible": "100",
                                  "tipo_impositivo": "10",
                                  "cuota_repercutida": "10"
                                }
                              ],
                              "importe_total": "352"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Invoice with multiple VAT rates"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            },
                            {
                              ""base_imponible"": ""100"",
                              ""tipo_impositivo"": ""10"",
                              ""cuota_repercutida"": ""10""
                            }
                          ],
                          ""importe_total"": ""352""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Invoice with multiple VAT rates""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }," & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""100""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""10""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""10""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""352""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — B2B Intra-Community - Sale of goods
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "B2B Intra-Community - Sale of goods",
                  "id_otro": {
                    "codigo_pais": "BE",
                    "id_type": "02",
                    "id": "BE0404621642"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "operacion_exenta": "E5"
                    }
                  ],
                  "importe_total": "200"
                }'
        - lang: Python
          label: Python — B2B Intra-Community - Sale of goods
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Sale of goods",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E5"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — B2B Intra-Community - Sale of goods
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Sale of goods",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E5"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — B2B Intra-Community - Sale of goods
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Sale of goods",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E5"
                }
              ],
              "importe_total": "200"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Sale of goods",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E5"
                }
              ],
              "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 — B2B Intra-Community - 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"B2B Intra-Community - Sale of goods\",\n  \"id_otro\": {\n    \"codigo_pais\": \"BE\",\n    \"id_type\": \"02\",\n    \"id\": \"BE0404621642\"\n  },\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"operacion_exenta\": \"E5\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — B2B Intra-Community - 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "B2B Intra-Community - Sale of goods",
                              "id_otro": {
                                "codigo_pais": "BE",
                                "id_type": "02",
                                "id": "BE0404621642"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "operacion_exenta": "E5"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — B2B Intra-Community - 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""B2B Intra-Community - Sale of goods"",
                          ""id_otro"": {
                            ""codigo_pais"": ""BE"",
                            ""id_type"": ""02"",
                            ""id"": ""BE0404621642""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""operacion_exenta"": ""E5""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — B2B Intra-Community - Sale of goods
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""B2B Intra-Community - Sale of goods""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""BE""," & vbCrLf & _
                  "    ""id_type"": ""02""," & vbCrLf & _
                  "    ""id"": ""BE0404621642""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""operacion_exenta"": ""E5""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""200""" & vbCrLf & _
                  "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — B2B Intra-Community - Provision of services
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "B2B Intra-Community - Provision of services",
                  "id_otro": {
                    "codigo_pais": "BE",
                    "id_type": "02",
                    "id": "BE0404621642"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "calificacion_operacion": "N2"
                    }
                  ],
                  "importe_total": "200"
                }'
        - lang: Python
          label: Python — B2B Intra-Community - Provision of services
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Provision of services",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — B2B Intra-Community - Provision of services
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Provision of services",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — B2B Intra-Community - Provision of services
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Provision of services",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2B Intra-Community - Provision of services",
              "id_otro": {
                "codigo_pais": "BE",
                "id_type": "02",
                "id": "BE0404621642"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "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 — B2B Intra-Community - 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"B2B Intra-Community - Provision of services\",\n  \"id_otro\": {\n    \"codigo_pais\": \"BE\",\n    \"id_type\": \"02\",\n    \"id\": \"BE0404621642\"\n  },\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"calificacion_operacion\": \"N2\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — B2B Intra-Community - 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "B2B Intra-Community - Provision of services",
                              "id_otro": {
                                "codigo_pais": "BE",
                                "id_type": "02",
                                "id": "BE0404621642"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "calificacion_operacion": "N2"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — B2B Intra-Community - 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""B2B Intra-Community - Provision of services"",
                          ""id_otro"": {
                            ""codigo_pais"": ""BE"",
                            ""id_type"": ""02"",
                            ""id"": ""BE0404621642""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""calificacion_operacion"": ""N2""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — B2B Intra-Community - Provision of services
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""B2B Intra-Community - Provision of services""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""BE""," & vbCrLf & _
                  "    ""id_type"": ""02""," & vbCrLf & _
                  "    ""id"": ""BE0404621642""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""calificacion_operacion"": ""N2""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""200""" & vbCrLf & _
                  "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — B2C Intra-Community - Below threshold
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "B2C Intra-Community - Below threshold"
                  "id_otro": {
                    "codigo_pais": "DE",
                    "id_type": "03",
                    "id": "F8624KW3J6"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "tipo_impositivo": "21",
                      "cuota_repercutida": "42"
                    }
                  ],
                  "importe_total": "242"
                }'
        - lang: Python
          label: Python — B2C Intra-Community - Below threshold
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Below threshold"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — B2C Intra-Community - Below threshold
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Below threshold"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — B2C Intra-Community - Below threshold
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Below threshold"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Below threshold"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "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 — B2C Intra-Community - Below 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"B2C Intra-Community - Below threshold\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — B2C Intra-Community - Below 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "B2C Intra-Community - Below threshold"
                              "id_otro": {
                                "codigo_pais": "DE",
                                "id_type": "03",
                                "id": "F8624KW3J6"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — B2C Intra-Community - Below 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""B2C Intra-Community - Below threshold""
                          ""id_otro"": {
                            ""codigo_pais"": ""DE"",
                            ""id_type"": ""03"",
                            ""id"": ""F8624KW3J6""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""importe_total"": ""242""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — B2C Intra-Community - Below threshold
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""B2C Intra-Community - Below threshold""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""DE""," & vbCrLf & _
                  "    ""id_type"": ""03""," & vbCrLf & _
                  "    ""id"": ""F8624KW3J6""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""tipo_impositivo"": ""21""" & vbCrLf & _
                  "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""242""" & vbCrLf & _
                  "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — B2C Intra-Community - Above threshold (OSS regime)
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
                  "id_otro": {
                    "codigo_pais": "DE",
                    "id_type": "03",
                    "id": "F8624KW3J6"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "clave_regimen": "17",
                      "calificacion_operacion": "N2"
                    }
                  ],
                  "importe_total": "200"
                }'
        - lang: Python
          label: Python — B2C Intra-Community - Above threshold (OSS regime)
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "17",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — B2C Intra-Community - Above threshold (OSS regime)
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "17",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — B2C Intra-Community - Above threshold (OSS regime)
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "17",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
              "id_otro": {
                "codigo_pais": "DE",
                "id_type": "03",
                "id": "F8624KW3J6"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "17",
                  "calificacion_operacion": "N2"
                }
              ],
              "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 — B2C Intra-Community - Above threshold (OSS regime)
          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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"B2C Intra-Community - Above threshold (OSS regime)\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"clave_regimen\": \"17\",\n      \"calificacion_operacion\": \"N2\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — B2C Intra-Community - Above threshold (OSS regime)
          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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "B2C Intra-Community - Above threshold (OSS regime)"
                              "id_otro": {
                                "codigo_pais": "DE",
                                "id_type": "03",
                                "id": "F8624KW3J6"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "clave_regimen": "17",
                                  "calificacion_operacion": "N2"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — B2C Intra-Community - Above threshold (OSS regime)
          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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""B2C Intra-Community - Above threshold (OSS regime)""
                          ""id_otro"": {
                            ""codigo_pais"": ""DE"",
                            ""id_type"": ""03"",
                            ""id"": ""F8624KW3J6""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""clave_regimen"": ""17"",
                              ""calificacion_operacion"": ""N2""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — B2C Intra-Community - Above threshold (OSS regime)
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""B2C Intra-Community - Above threshold (OSS regime)""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""DE""," & vbCrLf & _
                  "    ""id_type"": ""03""," & vbCrLf & _
                  "    ""id"": ""F8624KW3J6""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""clave_regimen"": ""17""" & vbCrLf & _
                  "      ""calificacion_operacion"": ""N2""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""200""" & vbCrLf & _
                  "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Extra-Community - Export of goods
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "Extra-Community - Export of goods"
                  "id_otro": {
                    "codigo_pais": "US",
                    "id_type": "03",
                    "id": "M76543210"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "clave_regimen": "02",
                      "operacion_exenta": "E2"
                    }
                  ],
                  "importe_total": "200"
                }'
        - lang: Python
          label: Python — Extra-Community - Export of goods
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Export of goods"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "02",
                  "operacion_exenta": "E2"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Extra-Community - Export of goods
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Export of goods"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "02",
                  "operacion_exenta": "E2"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Extra-Community - Export of goods
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Export of goods"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "02",
                  "operacion_exenta": "E2"
                }
              ],
              "importe_total": "200"
            };

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

            console.log(response.data);
        - lang: PHP
          label: PHP — Extra-Community - Export of goods
          source: |-
            <?php

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

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

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

            $body = <<<'JSON'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Export of goods"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "clave_regimen": "02",
                  "operacion_exenta": "E2"
                }
              ],
              "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_COUS);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Extra-Community - 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Extra-Community - Export of goods\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"clave_regimen\": \"02\",\n      \"operacion_exenta\": \"E2\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — Extra-Community - 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Extra-Community - Export of goods"
                              "id_otro": {
                                "codigo_pais": "US",
                                "id_type": "03",
                                "id": "M76543210"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "clave_regimen": "02",
                                  "operacion_exenta": "E2"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — Extra-Community - 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Extra-Community - Export of goods""
                          ""id_otro"": {
                            ""codigo_pais"": ""US"",
                            ""id_type"": ""03"",
                            ""id"": ""M76543210""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""clave_regimen"": ""02"",
                              ""operacion_exenta"": ""E2""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Extra-Community - Export of goods
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""Extra-Community - Export of goods""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""US""," & vbCrLf & _
                  "    ""id_type"": ""03""," & vbCrLf & _
                  "    ""id"": ""M76543210""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""clave_regimen"": ""02""" & vbCrLf & _
                  "      ""operacion_exenta"": ""E2""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""200""" & vbCrLf & _
                  "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Extra-Community - Provision of services
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "CURRENT_DATE",
                  "tipo_factura": "F1",
                  "descripcion": "Extra-Community - Provision of services"
                  "id_otro": {
                    "codigo_pais": "US",
                    "id_type": "03",
                    "id": "M76543210"
                  },
                  "nombre": "Customer name",
                  "lineas": [
                    {
                      "base_imponible": "200",
                      "calificacion_operacion": "N2"
                    }
                  ],
                  "importe_total": "200"
                }'
        - lang: Python
          label: Python — Extra-Community - Provision of services
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Provision of services"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Extra-Community - Provision of services
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Provision of services"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Extra-Community - Provision of services
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Provision of services"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "importe_total": "200"
            };

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

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

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

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

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

            $body = <<<'JSON'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Extra-Community - Provision of services"
              "id_otro": {
                "codigo_pais": "US",
                "id_type": "03",
                "id": "M76543210"
              },
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N2"
                }
              ],
              "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_COUS);
            curl_close($ch);

            echo "HTTP Status: " . $httpCode . "\n";
            echo $response;
        - lang: Go
          label: Go — Extra-Community - 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Extra-community - Provision of goods\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"calificacion_operacion\": \"N2\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — Extra-Community - 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Extra-Community - Provision of services"
                              "id_otro": {
                                "codigo_pais": "US",
                                "id_type": "03",
                                "id": "M76543210"
                              },
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "calificacion_operacion": "N2"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — Extra-Community - 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Extra-Community - Provision of services""
                          ""id_otro"": {
                            ""codigo_pais"": ""US"",
                            ""id_type"": ""03"",
                            ""id"": ""M76543210""
                          },
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""calificacion_operacion"": ""N2""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Extra-Community - Provision of services
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                  "  ""serie"": ""A""," & vbCrLf & _
                  "  ""numero"": ""1""," & vbCrLf & _
                  "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                  "  ""tipo_factura"": ""F1""," & vbCrLf & _
                  "  ""descripcion"": ""Extra-Community - Provision of services""," & vbCrLf & _
                  "  ""id_otro"": {" & vbCrLf & _
                  "    ""codigo_pais"": ""US""," & vbCrLf & _
                  "    ""id_type"": ""03""," & vbCrLf & _
                  "    ""id"": ""M76543210""" & vbCrLf & _
                  "  }," & vbCrLf & _
                  "  ""nombre"": ""Customer name""," & vbCrLf & _
                  "  ""lineas"": [" & vbCrLf & _
                  "    {" & vbCrLf & _
                  "      ""base_imponible"": ""200""," & vbCrLf & _
                  "      ""calificacion_operacion"": ""N2""" & vbCrLf & _
                  "    }" & vbCrLf & _
                  "  ]," & vbCrLf & _
                  "  ""importe_total"": ""200""" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Exempt operation",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "operacion_exenta": "E1"
                     }
                   ],
                   "importe_total": "200"
                 }'
        - lang: Python
          label: Python — VAT exempt
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Exempt operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E1"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — VAT exempt
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Exempt operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E1"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — VAT exempt
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Exempt operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E1"
                }
              ],
              "importe_total": "200"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Exempt operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "operacion_exenta": "E1"
                }
              ],
              "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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Exempt operation\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"operacion_exenta\": \"E1\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Exempt operation",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "operacion_exenta": "E1"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Exempt operation"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""operacion_exenta"": ""E1""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Exempt operation""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""operacion_exenta"": ""E1""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""200""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Non-subject operation
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "Examples",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Non-subject operation",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "calificacion_operacion": "N1"
                     }
                   ],
                   "importe_total": "200"
                 }'
        - lang: Python
          label: Python — Non-subject operation
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Non-subject operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N1"
                }
              ],
              "importe_total": "200"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Non-subject operation
          source: |-
            const body = {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Non-subject operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N1"
                }
              ],
              "importe_total": "200"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Non-subject operation
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Non-subject operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N1"
                }
              ],
              "importe_total": "200"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Non-subject operation",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "calificacion_operacion": "N1"
                }
              ],
              "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 — Non-subject operation
          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  \"serie\": \"Examples\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Non-subject operation\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"calificacion_operacion\": \"N1\"\n    }\n  ],\n  \"importe_total\": \"200\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — Non-subject operation
          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 = """
                            {
                              "serie": "Examples",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Non-subject operation",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "calificacion_operacion": "N1"
                                }
                              ],
                              "importe_total": "200"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — Non-subject operation
          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 = @"
                        {
                          ""serie"": ""Examples"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Non-subject operation"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""calificacion_operacion"": ""N1""
                            }
                          ],
                          ""importe_total"": ""200""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Non-subject operation
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""Examples""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Non-subject operation""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""calificacion_operacion"": ""N1""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""200""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Invoice with IGIC
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Operation with IGIC",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "impuesto": "03",
                       "base_imponible": "200",
                       "tipo_impositivo": "7",
                       "cuota_repercutida": "14"
                     }
                   ],
                   "importe_total": "214"
                 }'
        - lang: Python
          label: Python — Invoice with IGIC
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IGIC",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "03",
                  "base_imponible": "200",
                  "tipo_impositivo": "7",
                  "cuota_repercutida": "14"
                }
              ],
              "importe_total": "214"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Invoice with IGIC
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IGIC",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "03",
                  "base_imponible": "200",
                  "tipo_impositivo": "7",
                  "cuota_repercutida": "14"
                }
              ],
              "importe_total": "214"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Invoice with IGIC
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IGIC",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "03",
                  "base_imponible": "200",
                  "tipo_impositivo": "7",
                  "cuota_repercutida": "14"
                }
              ],
              "importe_total": "214"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IGIC",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "03",
                  "base_imponible": "200",
                  "tipo_impositivo": "7",
                  "cuota_repercutida": "14"
                }
              ],
              "importe_total": "214"
            }
            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 with IGIC
          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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Operation with IGIC\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"impuesto\": \"03\",\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"7\",\n      \"cuota_repercutida\": \"14\"\n    }\n  ],\n  \"importe_total\": \"214\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 with IGIC
          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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Operation with IGIC",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "impuesto": "03",
                                  "base_imponible": "200",
                                  "tipo_impositivo": "7",
                                  "cuota_repercutida": "14"
                                }
                              ],
                              "importe_total": "214"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 with IGIC
          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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Operation with IGIC"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""impuesto"": ""03"",
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""7"",
                              ""cuota_repercutida"": ""14""
                            }
                          ],
                          ""importe_total"": ""214""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Invoice with IGIC
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Operation with IGIC""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""impuesto"": ""03""," & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""7""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""14""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""214""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Invoice with IPSI
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Operation with IPSI",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "impuesto": "02",
                       "base_imponible": "200",
                       "tipo_impositivo": "4",
                       "cuota_repercutida": "8"
                     }
                   ],
                   "importe_total": "208"
                 }'
        - lang: Python
          label: Python — Invoice with IPSI
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IPSI",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "02",
                  "base_imponible": "200",
                  "tipo_impositivo": "4",
                  "cuota_repercutida": "8"
                }
              ],
              "importe_total": "208"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Invoice with IPSI
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IPSI",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "02",
                  "base_imponible": "200",
                  "tipo_impositivo": "4",
                  "cuota_repercutida": "8"
                }
              ],
              "importe_total": "208"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Invoice with IPSI
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IPSI",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "02",
                  "base_imponible": "200",
                  "tipo_impositivo": "4",
                  "cuota_repercutida": "8"
                }
              ],
              "importe_total": "208"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation with IPSI",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "impuesto": "02",
                  "base_imponible": "200",
                  "tipo_impositivo": "4",
                  "cuota_repercutida": "8"
                }
              ],
              "importe_total": "208"
            }
            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 with 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Operation with IPSI\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"impuesto\": \"02\",\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"4\",\n      \"cuota_repercutida\": \"8\"\n    }\n  ],\n  \"importe_total\": \"208\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 with 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Operation with IPSI",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "impuesto": "02",
                                  "base_imponible": "200",
                                  "tipo_impositivo": "4",
                                  "cuota_repercutida": "8"
                                }
                              ],
                              "importe_total": "208"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 with 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Operation with IPSI"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""impuesto"": ""02"",
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""4"",
                              ""cuota_repercutida"": ""8""
                            }
                          ],
                          ""importe_total"": ""208""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Invoice with IPSI
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Operation with IPSI""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""impuesto"": ""02""," & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""4""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""8""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""208""" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Credit note",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "-200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "-42"
                     }
                   ],
                   "importe_total": "-242"
                 }'
        - lang: Python
          label: Python — Credit note
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Credit note",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-42"
                }
              ],
              "importe_total": "-242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Credit note
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Credit note",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-42"
                }
              ],
              "importe_total": "-242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Credit note
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Credit note",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-42"
                }
              ],
              "importe_total": "-242"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Credit note",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-200",
                  "tipo_impositivo": "21",
                  "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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Credit note\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"-200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"-42\"\n    }\n  ],\n  \"importe_total\": \"-242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Credit note",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "-200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "-42"
                                }
                              ],
                              "importe_total": "-242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Credit note"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""-200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""-42""
                            }
                          ],
                          ""importe_total"": ""-242""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Credit note""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""-200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""-42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""-242""" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "Ejemplos",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Reverse charge",
                   "nif": "B12345678",
                   "nombre": "Recipient Company SL",
                   "lineas": [
                     {
                       "base_imponible": "1000",
                       "tipo_impositivo": "0",
                       "cuota_repercutida": "0",
                       "calificacion_operacion": "S2"
                     }
                   ],
                   "importe_total": "1000"
                 }'
        - lang: Python
          label: Python — Reverse charge
          source: |-
            import requests

            url = "https://api.verifacti.com/verifactu/create"
            headers = {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
            }
            data = {
                "serie": "Ejemplos",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "descripcion": "Reverse charge",
                "nif": "B12345678",
                "nombre": "Recipient Company SL",
                "lineas": [
                    {
                        "base_imponible": "1000",
                        "tipo_impositivo": "0",
                        "cuota_repercutida": "0",
                        "calificacion_operacion": "S2"
                    }
                ],
                "importe_total": "1000"
            }

            response = requests.post(url, json=data, headers=headers)
            print(f"Status Code: {response.status_code}")
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Reverse charge
          source: |-
            const data = {
              "serie": "Ejemplos",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Reverse charge",
              "nif": "B12345678",
              "nombre": "Recipient Company SL",
              "lineas": [
                {
                  "base_imponible": "1000",
                  "tipo_impositivo": "0",
                  "cuota_repercutida": "0",
                  "calificacion_operacion": "S2"
                }
              ],
              "importe_total": "1000"
            };

            fetch('https://api.verifacti.com/verifactu/create', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer <API_KEY>',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify(data)
            })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error('Error:', error));
        - lang: Node.js
          label: Node.js — Reverse charge
          source: |-
            const https = require('https');

            const data = JSON.stringify({
              "serie": "Ejemplos",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Reverse charge",
              "nif": "B12345678",
              "nombre": "Recipient Company SL",
              "lineas": [
                {
                  "base_imponible": "1000",
                  "tipo_impositivo": "0",
                  "cuota_repercutida": "0",
                  "calificacion_operacion": "S2"
                }
              ],
              "importe_total": "1000"
            });

            const options = {
              hostname: 'api.verifacti.com',
              path: '/verifactu/create',
              method: 'POST',
              headers: {
                'Authorization': 'Bearer <API_KEY>',
                'Content-Type': 'application/json',
                'Content-Length': data.length
              }
            };

            const req = https.request(options, (res) => {
              let body = '';
              res.on('data', (chunk) => body += chunk);
              res.on('end', () => {
                console.log('Status:', res.statusCode);
                console.log(body);
              });
            });

            req.on('error', (error) => console.error(error));
            req.write(data);
            req.end();
        - lang: PHP
          label: PHP — Reverse charge
          source: |-
            <?php
            $url = 'https://api.verifacti.com/verifactu/create';
            $data = [
                'serie' => 'Ejemplos',
                'numero' => '1',
                'fecha_expedicion' => 'CURRENT_DATE',
                'tipo_factura' => 'F1',
                'descripcion' => 'Reverse charge',
                'nif' => 'B12345678',
                'nombre' => 'Recipient Company SL',
                'lineas' => [
                    [
                        'base_imponible' => '1000',
                        'tipo_impositivo' => '0',
                        'cuota_repercutida' => '0',
                        'calificacion_operacion' => 'S2'
                    ]
                ],
                'importe_total' => '1000'
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
            curl_setopt($ch, CURLOPT_HTTPHEADER, [
                'Authorization: Bearer <API_KEY>',
                'Content-Type: application/json'
            ]);

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

            echo "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  \"serie\": \"Ejemplos\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Reverse charge\",\n  \"nif\": \"B12345678\",\n  \"nombre\": \"Recipient Company SL\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"1000\",\n      \"tipo_impositivo\": \"0\",\n      \"cuota_repercutida\": \"0\",\n      \"calificacion_operacion\": \"S2\"\n    }\n  ],\n  \"importe_total\": \"1000\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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.io.BufferedReader;
            import java.io.InputStreamReader;
            import java.io.OutputStream;
            import java.net.HttpURLConnection;
            import java.net.URL;

            public class Main {
                public static void main(String[] args) {
                    try {
                        URL url = new URL("https://api.verifacti.com/verifactu/create");
                        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                        conn.setRequestMethod("POST");
                        conn.setRequestProperty("Authorization", "Bearer <API_KEY>");
                        conn.setRequestProperty("Content-Type", "application/json");
                        conn.setDoOutput(true);

                        String jsonInputString = "{"
                              + "\"serie\": \"Ejemplos\","
                              + "\"numero\": \"1\","
                              + "\"fecha_expedicion\": \"CURRENT_DATE\","
                              + "\"tipo_factura\": \"F1\","
                              + "\"descripcion\": \"Reverse charge\","
                              + "\"nif\": \"B12345678\","
                              + "\"nombre\": \"Recipient Company SL\","
                              + "\"lineas\": [{\"base_imponible\": \"1000\", \"tipo_impositivo\": \"0\", \"cuota_repercutida\": \"0\", \"calificacion_operacion\": \"S2\"}],"
                              + "\"importe_total\": \"1000\""                              + "}";

                        try(OutputStream os = conn.getOutputStream()) {
                            byte[] input = jsonInputString.getBytes("utf-8");
                            os.write(input, 0, input.length);
                        }

                        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
                        StringBuilder response = new StringBuilder();
                        String responseLine;
                        while ((responseLine = br.readLine()) != null) {
                            response.append(responseLine.trim());
                        }
                        System.out.println("Status: " + conn.getResponseCode());
                        System.out.println(response.toString());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        - 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(string[] args) {
                    var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");

                    var json = @"{
                          ""serie"": ""Ejemplos"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Reverse charge"",
                          ""nif"": ""B12345678"",
                         ""nombre"": ""Recipient Company SL"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""1000"",
                              ""tipo_impositivo"": ""0"",
                              ""cuota_repercutida"": ""0"",
                              ""calificacion_operacion"": ""S2""
                            }
                          ],
                          ""importe_total"": ""1000""
                        }";

                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/create", content);
                    var result = await response.Content.ReadAsStringAsync();

                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(result);
                }
            }
        - lang: VB6
          label: VB6 — Reverse charge
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""Ejemplos""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Reverse charge""," & vbCrLf & _
                   "  ""nif"": ""B12345678""," & vbCrLf & _
                   "  ""nombre"": ""Recipient Company SL""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""1000""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""0""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""0""," & vbCrLf & _
                   "      ""calificacion_operacion"": ""S2""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""1000""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Replacement invoice
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F3",
                   "descripcion": "Operation description",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "facturas_sustituidas": [
                     {
                       "serie": "SIMPLE",
                       "numero": "1",
                       "fecha_expedicion": "19-06-2025"
                     }
                   ],
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python — Replacement invoice
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "19-06-2025"
                }
              ],
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Replacement invoice
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "19-06-2025"
                }
              ],
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Replacement invoice
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "19-06-2025"
                }
              ],
              "importe_total": "242"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F3",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "facturas_sustituidas": [
                {
                  "serie": "SIMPLE",
                  "numero": "1",
                  "fecha_expedicion": "19-06-2025"
                }
              ],
              "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 — Replacement 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F3\",\n  \"descripcion\": \"Operation description\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"facturas_sustituidas\": [\n    {\n      \"serie\": \"SIMPLE\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"19-06-2025\"\n    }\n  ],\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 — Replacement 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F3",
                              "descripcion": "Operation description",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "facturas_sustituidas": [
                                {
                                  "serie": "SIMPLE",
                                  "numero": "1",
                                  "fecha_expedicion": "19-06-2025"
                                }
                              ],
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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# — Replacement 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F3"",
                          ""descripcion"": ""Operation description"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""facturas_sustituidas"": [
                            {
                              ""serie"": ""SIMPLE"",
                              ""numero"": ""1"",
                              ""fecha_expedicion"": ""19-06-2025""
                            }
                          ],
                          ""importe_total"": ""242""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Replacement invoice
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F3""," & vbCrLf & _
                   "  ""descripcion"": ""Operation description""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""facturas_sustituidas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""serie"": ""SIMPLE""," & vbCrLf & _
                   "      ""numero"": ""1""," & vbCrLf & _
                   "      ""fecha_expedicion"": ""19-06-2025""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""242""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Corrective by substitution
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "R",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "fecha_operacion": "01-04-2025",
                   "tipo_factura": "R1",
                   "tipo_rectificativa": "S",
                   "descripcion": "Correction by substitution in one step",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "800",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "168"
                     }
                   ],
                   "importe_total": "968",
                   "importe_rectificativa": {
                     "base_rectificada": "1000",
                     "cuota_rectificada": "210"
                   },
                   "facturas_rectificadas": [
                     {
                       "serie": "A",
                       "numero": "1",
                       "fecha_expedicion": "07-04-2025"
                     }
                   ]
                 }'
        - lang: Python
          label: Python — Corrective by substitution
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "fecha_operacion": "01-04-2025",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "descripcion": "Correction by substitution in one step",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "800",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "168"
                }
              ],
              "importe_total": "968",
              "importe_rectificativa": {
                "base_rectificada": "1000",
                "cuota_rectificada": "210"
              },
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Corrective by substitution
          source: |-
            const body = {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "fecha_operacion": "01-04-2025",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "descripcion": "Correction by substitution in one step",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "800",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "168"
                }
              ],
              "importe_total": "968",
              "importe_rectificativa": {
                "base_rectificada": "1000",
                "cuota_rectificada": "210"
              },
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Corrective by substitution
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "fecha_operacion": "01-04-2025",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "descripcion": "Correction by substitution in one step",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "800",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "168"
                }
              ],
              "importe_total": "968",
              "importe_rectificativa": {
                "base_rectificada": "1000",
                "cuota_rectificada": "210"
              },
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "fecha_operacion": "01-04-2025",
              "tipo_factura": "R1",
              "tipo_rectificativa": "S",
              "descripcion": "Correction by substitution in one step",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "800",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "168"
                }
              ],
              "importe_total": "968",
              "importe_rectificativa": {
                "base_rectificada": "1000",
                "cuota_rectificada": "210"
              },
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            }
            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 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  \"serie\": \"R\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"fecha_operacion\": \"01-04-2025\",\n  \"tipo_factura\": \"R1\",\n  \"tipo_rectificativa\": \"S\",\n  \"descripcion\": \"Correction by substitution in one step\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"800\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"168\"\n    }\n  ],\n  \"importe_total\": \"968\",\n  \"importe_rectificativa\": {\n    \"base_rectificada\": \"1000\",\n    \"cuota_rectificada\": \"210\"\n  },\n  \"facturas_rectificadas\": [\n    {\n      \"serie\": \"A\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"07-04-2025\"\n    }\n  ]\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 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 = """
                            {
                              "serie": "R",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "fecha_operacion": "01-04-2025",
                              "tipo_factura": "R1",
                              "tipo_rectificativa": "S",
                              "descripcion": "Correction by substitution in one step",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "800",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "168"
                                }
                              ],
                              "importe_total": "968",
                              "importe_rectificativa": {
                                "base_rectificada": "1000",
                                "cuota_rectificada": "210"
                              },
                              "facturas_rectificadas": [
                                {
                                  "serie": "A",
                                  "numero": "1",
                                  "fecha_expedicion": "07-04-2025"
                                }
                              ]
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 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 = @"
                        {
                          ""serie"": ""R"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""fecha_operacion"": ""01-04-2025"",
                          ""tipo_factura"": ""R1"",
                          ""tipo_rectificativa"": ""S"",
                          ""descripcion"": ""Correction by substitution in one step"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""800"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""168""
                            }
                          ],
                          ""importe_total"": ""968"",
                          ""importe_rectificativa"": {
                            ""base_rectificada"": ""1000"",
                            ""cuota_rectificada"": ""210""
                          },
                          ""facturas_rectificadas"": [
                            {
                              ""serie"": ""A"",
                              ""numero"": ""1"",
                              ""fecha_expedicion"": ""07-04-2025""
                            }
                          ]
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Corrective by substitution
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""R""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""fecha_operacion"": ""01-04-2025""," & vbCrLf & _
                   "  ""tipo_factura"": ""R1""," & vbCrLf & _
                   "  ""tipo_rectificativa"": ""S""," & vbCrLf & _
                   "  ""descripcion"": ""Correction by substitution in one step""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""800""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""168""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""968""," & vbCrLf & _
                   "  ""importe_rectificativa"": {" & vbCrLf & _
                   "    ""base_rectificada"": ""1000""," & vbCrLf & _
                   "    ""cuota_rectificada"": ""210""" & vbCrLf & _
                   "  }," & vbCrLf & _
                   "  ""facturas_rectificadas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""serie"": ""A""," & vbCrLf & _
                   "      ""numero"": ""1""," & vbCrLf & _
                   "      ""fecha_expedicion"": ""07-04-2025""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Corrective by differences
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "R",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "R1",
                   "tipo_rectificativa": "I",
                   "descripcion": "Operation description: correction by differences",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "-500",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "-105"
                     }
                   ],
                   "importe_total": "-605",
                   "facturas_rectificadas": [
                     {
                       "serie": "A",
                       "numero": "1",
                       "fecha_expedicion": "07-04-2025"
                     }
                   ]
                 }'
        - lang: Python
          label: Python — Corrective by differences
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "descripcion": "Operation description: correction by differences",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-500",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-105"
                }
              ],
              "importe_total": "-605",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Corrective by differences
          source: |-
            const body = {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "descripcion": "Operation description: correction by differences",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-500",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-105"
                }
              ],
              "importe_total": "-605",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Corrective by differences
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "descripcion": "Operation description: correction by differences",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-500",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-105"
                }
              ],
              "importe_total": "-605",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "R",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "R1",
              "tipo_rectificativa": "I",
              "descripcion": "Operation description: correction by differences",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "-500",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "-105"
                }
              ],
              "importe_total": "-605",
              "facturas_rectificadas": [
                {
                  "serie": "A",
                  "numero": "1",
                  "fecha_expedicion": "07-04-2025"
                }
              ]
            }
            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 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  \"serie\": \"R\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"R1\",\n  \"tipo_rectificativa\": \"I\",\n  \"descripcion\": \"Operation description: correction by differences\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"-500\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"-105\"\n    }\n  ],\n  \"importe_total\": \"-605\",\n  \"facturas_rectificadas\": [\n    {\n      \"serie\": \"A\",\n      \"numero\": \"1\",\n      \"fecha_expedicion\": \"07-04-2025\"\n    }\n  ]\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 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 = """
                            {
                              "serie": "R",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "R1",
                              "tipo_rectificativa": "I",
                              "descripcion": "Operation description: correction by differences",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "-500",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "-105"
                                }
                              ],
                              "importe_total": "-605",
                              "facturas_rectificadas": [
                                {
                                  "serie": "A",
                                  "numero": "1",
                                  "fecha_expedicion": "07-04-2025"
                                }
                              ]
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 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 = @"
                        {
                          ""serie"": ""R"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""R1"",
                          ""tipo_rectificativa"": ""I"",
                          ""descripcion"": ""Operation description: correction by differences"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""-500"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""-105""
                            }
                          ],
                          ""importe_total"": ""-605"",
                          ""facturas_rectificadas"": [
                            {
                              ""serie"": ""A"",
                              ""numero"": ""1"",
                              ""fecha_expedicion"": ""07-04-2025""
                            }
                          ]
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Corrective by differences
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""R""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""R1""," & vbCrLf & _
                   "  ""tipo_rectificativa"": ""I""," & vbCrLf & _
                   "  ""descripcion"": ""Operation description: correction by differences""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""-500""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""-105""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""-605""," & vbCrLf & _
                   "  ""facturas_rectificadas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""serie"": ""A""," & vbCrLf & _
                   "      ""numero"": ""1""," & vbCrLf & _
                   "      ""fecha_expedicion"": ""07-04-2025""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]" & 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 -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "RECARGO",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Operation description",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42",
                       "clave_regimen": "18",
                       "tipo_recargo_equivalencia": "5.2",
                       "cuota_recargo_equivalencia": "10.4"
                     }
                   ],
                   "importe_total": "252.4"
                 }'
        - lang: Python
          label: Python — Equivalence surcharge
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "RECARGO",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42",
                  "clave_regimen": "18",
                  "tipo_recargo_equivalencia": "5.2",
                  "cuota_recargo_equivalencia": "10.4"
                }
              ],
              "importe_total": "252.4"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Equivalence surcharge
          source: |-
            const body = {
              "serie": "RECARGO",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42",
                  "clave_regimen": "18",
                  "tipo_recargo_equivalencia": "5.2",
                  "cuota_recargo_equivalencia": "10.4"
                }
              ],
              "importe_total": "252.4"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Equivalence surcharge
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "RECARGO",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42",
                  "clave_regimen": "18",
                  "tipo_recargo_equivalencia": "5.2",
                  "cuota_recargo_equivalencia": "10.4"
                }
              ],
              "importe_total": "252.4"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "RECARGO",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42",
                  "clave_regimen": "18",
                  "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  \"serie\": \"RECARGO\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Operation description\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\",\n      \"clave_regimen\": \"18\",\n      \"tipo_recargo_equivalencia\": \"5.2\",\n      \"cuota_recargo_equivalencia\": \"10.4\"\n    }\n  ],\n  \"importe_total\": \"252.4\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "RECARGO",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Operation description",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42",
                                  "clave_regimen": "18",
                                  "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/verifactu/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 = @"
                        {
                          ""serie"": ""RECARGO"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Operation description"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42"",
                              ""clave_regimen"": ""18"",
                              ""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/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""RECARGO""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Operation description""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""," & vbCrLf & _
                   "      ""clave_regimen"": ""18""," & vbCrLf & _
                   "      ""tipo_recargo_equivalencia"": ""5.2""," & vbCrLf & _
                   "      ""cuota_recargo_equivalencia"": ""10.4""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""252.4""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Issued by third party
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Invoice issued by third party",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "especial": {
                     "emitida_por_tercero_o_destinatario": "T",
                     "nombre_tercero": "Third party name",
                     "nif_tercero": "B86561412"
                   },
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python — Issued by third party
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by third party",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "T",
                "nombre_tercero": "Third party name",
                "nif_tercero": "B86561412"
              },
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Issued by third party
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by third party",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "T",
                "nombre_tercero": "Third party name",
                "nif_tercero": "B86561412"
              },
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Issued by third party
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by third party",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "T",
                "nombre_tercero": "Third party name",
                "nif_tercero": "B86561412"
              },
              "importe_total": "242"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by third party",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "T",
                "nombre_tercero": "Third party name",
                "nif_tercero": "B86561412"
              },
              "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 third party
          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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Invoice issued by third party\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"especial\": {\n    \"emitida_por_tercero_o_destinatario\": \"T\",\n    \"nombre_tercero\": \"Third party name\",\n    \"nif_tercero\": \"B86561412\"\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 third party
          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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Invoice issued by third party",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "especial": {
                                "emitida_por_tercero_o_destinatario": "T",
                                "nombre_tercero": "Third party name",
                                "nif_tercero": "B86561412"
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 third party
          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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Invoice issued by third party"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""especial"": {
                            ""emitida_por_tercero_o_destinatario"": ""T"",
                            ""nombre_tercero"": ""Third party name"",
                            ""nif_tercero"": ""B86561412""
                          },
                          ""importe_total"": ""242""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Issued by third party
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Invoice issued by third party""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""especial"": {" & vbCrLf & _
                   "    ""emitida_por_tercero_o_destinatario"": ""T""," & vbCrLf & _
                   "    ""nombre_tercero"": ""Third party name""," & vbCrLf & _
                   "    ""nif_tercero"": ""B86561412""" & vbCrLf & _
                   "  }," & vbCrLf & _
                   "  ""importe_total"": ""242""" & vbCrLf & _
                   "}"

            oHttp.send sBody

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

            Set oHttp = Nothing
        - lang: cURL
          label: cURL — Issued by recipient
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Invoice issued by recipient",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "especial": {
                     "emitida_por_tercero_o_destinatario": "D"
                   },
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python — Issued by recipient
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by recipient",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "D"
              },
              "importe_total": "242"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Issued by recipient
          source: |-
            const body = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by recipient",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "D"
              },
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Issued by recipient
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by recipient",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "D"
              },
              "importe_total": "242"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "A",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice issued by recipient",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "especial": {
                "emitida_por_tercero_o_destinatario": "D"
              },
              "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 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  \"serie\": \"A\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Invoice issued by recipient\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"especial\": {\n    \"emitida_por_tercero_o_destinatario\": \"D\"\n  },\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 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 = """
                            {
                              "serie": "A",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Invoice issued by recipient",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "especial": {
                                "emitida_por_tercero_o_destinatario": "D"
                              },
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Invoice issued by recipient"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""especial"": {
                            ""emitida_por_tercero_o_destinatario"": ""D""
                          },
                          ""importe_total"": ""242""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Issued by recipient
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Invoice issued by recipient""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""especial"": {" & vbCrLf & _
                   "    ""emitida_por_tercero_o_destinatario"": ""D""" & vbCrLf & _
                   "  }," & vbCrLf & _
                   "  ""importe_total"": ""242""" & 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 regime
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "Examples",
                   "numero": "1",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Invoice under special regime for second-hand goods (REBU)",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "826.45",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "173.55",
                       "clave_regimen": "03"
                     }
                   ],
                   "importe_total": "3000"
                 }'
        - lang: Python
          label: Python — Second-hand goods regime
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create"

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

            payload = json.loads("""
            {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice under special regime for second-hand goods (REBU)",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "826.45",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "173.55",
                  "clave_regimen": "03"
                }
              ],
              "importe_total": "3000"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript — Second-hand goods regime
          source: |-
            const body = {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice under special regime for second-hand goods (REBU)",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "826.45",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "173.55",
                  "clave_regimen": "03"
                }
              ],
              "importe_total": "3000"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/create", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js — Second-hand goods regime
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice under special regime for second-hand goods (REBU)",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "826.45",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "173.55",
                  "clave_regimen": "03"
                }
              ],
              "importe_total": "3000"
            };

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

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

            $url = "https://api.verifacti.com/verifactu/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'
            {
              "serie": "Examples",
              "numero": "1",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Invoice under special regime for second-hand goods (REBU)",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "826.45",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "173.55",
                  "clave_regimen": "03"
                }
              ],
              "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 regime
          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  \"serie\": \"Examples\",\n  \"numero\": \"1\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Invoice under special regime for second-hand goods (REBU)\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"826.45\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"173.55\",\n      \"clave_regimen\": \"03\"\n    }\n  ],\n  \"importe_total\": \"3000\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 regime
          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 = """
                            {
                              "serie": "Examples",
                              "numero": "1",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Invoice under special regime for second-hand goods (REBU)",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "826.45",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "173.55",
                                  "clave_regimen": "03"
                                }
                              ],
                              "importe_total": "3000"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 regime
          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 = @"
                        {
                          ""serie"": ""Examples"",
                          ""numero"": ""1"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Invoice under special regime for second-hand goods (REBU)"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""826.45"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""173.55"",
                              ""clave_regimen"": ""03""
                            }
                          ],
                          ""importe_total"": ""3000""
                        }
                    ";

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

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

                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine($"Status: {response.StatusCode}");
                    Console.WriteLine(responseBody);
                }
            }
        - lang: VB6
          label: VB6 — Second-hand goods regime
          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/verifactu/create"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""Examples""," & vbCrLf & _
                   "  ""numero"": ""1""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Invoice under special regime for second-hand goods (REBU)""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""826.45""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""173.55""," & vbCrLf & _
                   "      ""clave_regimen"": ""03""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""3000""" & 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 that guarantees retries of the same request don't create duplicates. Printable ASCII string, 1–255 characters. Remembered per NIF for 24 hours.
          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:
                - serie
                - numero
                - fecha_expedicion
                - tipo_factura
                - descripcion
                - lineas
                - importe_total
              properties:
                serie:
                  type: string
                  example: A
                  description: |
                    Invoice series. If no series is desired, an empty string can be sent. It must not begin with a blank space. The concatenation of the series and number fields cannot exceed 60 characters.
                numero:
                  type: string
                  example: '234634'
                  description: Invoice number. The concatenation of the series and number fields cannot exceed 60 characters.
                fecha_expedicion:
                  type: string
                  example: CURRENT_DATE
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  description: |
                    Invoice issue date which <span style="color: red">must be the current date</span>. If you want to issue an invoice for an operation that occurred on a past date, use the `fecha_operacion` field.
                fecha_operacion:
                  type: string
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  description: Operation date. Can be a date prior to the current date.
                tipo_factura:
                  type: string
                  example: F1
                  enum:
                    - F1
                    - F2
                    - R1
                    - R2
                    - R3
                    - R4
                    - R5
                    - F3
                  description: |
                    The different invoice types are:
                    <ol style="list-style: disc;">
                      <li>F1: Invoice (Art. 6, 7.2 and 7.3 of RD 1619/2012)</li>
                      <li>F2: Simplified invoice and invoices without recipient identification (Art. 6.1.D RD 1619/2012)</li>
                      <li>R1: Corrective invoice (Art. 80.1 and 80.2 and error based on law)</li>
                      <li>R2: Corrective invoice (Art. 80.3)</li>
                      <li>R3: Corrective invoice (Art. 80.4)</li>
                      <li>R4: Corrective invoice (Other)</li>
                      <li>R5: Corrective invoice for simplified invoices (Art. 80.3)</li>
                      <li>F3: Invoice issued as replacement for billed and declared simplified invoices</li>
                    </ol>
                descripcion:
                  type: string
                  example: Operation description
                  minLength: 1
                  maxLength: 500
                  description: Operation description.
                lineas:
                  type: array
                  minItems: 1
                  maxItems: 12
                  description: |
                    Invoice lines. Accepts up to a maximum of 12 lines, a restriction imposed by the Tax Agency API.
                    Each line can have a different VAT rate, therefore, it is expected that different elements of
                    an invoice with the same VAT rate are grouped into a single line. Otherwise, it would be common to exceed the 12-line limit.
                  items:
                    $ref: '#/components/schemas/lineas'
                importe_total:
                  type: string
                  pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                  description: |
                    Total invoice amount. It will be validated to equal the sum of (`base_imponible` + `cuota_repercutida` + 
                    `cuota_recargo_equivalencia`) of all lines with an allowed margin of error of +/- €10.00. This validation will not
                    be applied when `clave_regimen` is 03, 05, 06, 08, or 09.
                  example: '242.00'
                nif:
                  type: string
                  example: A15022510
                  description: |
                    Recipient's NIF (tax ID). Required except for simplified invoices (F2, R5) or when the `id_otro` field is included.
                    If both `nif` and `id_otro` are included, `nif` will be used.

                    &nbsp;

                    If the `nif` field is included, we validate by default that it is registered with the AEAT, since if it is not, the AEAT will reject the submission. If
                    not registered, a 400 error will be returned, meaning the invoicing record has not been generated and no submission to the AEAT will occur.

                    &nbsp;

                    For legal entities, it is sufficient for the NIF to be registered. For individuals, the NIF must be registered and the `nombre` must be
                    sufficiently similar to the name in the census.

                    &nbsp;

                    We have an endpoint to validate the NIF of individuals and legal entities in the NIF management API. The documentation can be found
                    <a href="https://www.verifacti.com/nifs-docs#tag/NIFs/paths/~1nifs~1validar/post" target="_blank">here</a>.
                id_otro:
                  type: object
                  description: |
                    Identifier for an individual or legal entity other than the NIF. Required except for simplified invoices (F2, R5) or when
                    the `nif` field is included. If both `nif` and `id_otro` are included, `nif` will be used.

                    &nbsp;

                    If the `codigo_pais` field equals ES, the `id_type` field will be validated to be 03 or 07. If the `id_type` field is 07,
                    the `codigo_pais` field will be validated to be ES.
                  properties:
                    codigo_pais:
                      type: string
                      description: Country code of the individual or legal entity in ISO 3166-1 alpha-2 format. Required except when `id_type` is 02.
                    id_type:
                      type: string
                      enum:
                        - '02'
                        - '03'
                        - '04'
                        - '05'
                        - '06'
                        - '07'
                      description: |
                        Identifier type for the individual or legal entity. The different identifier types are:
                        <ol style="list-style: disc;">
                          <li>02: VAT ID (NIF-IVA)</li>
                          <li>03: Passport</li>
                          <li>04: ID in country of residence</li>
                          <li>05: Residence certificate</li>
                          <li>06: Other supporting document</li>
                          <li>07: Not registered</li>
                        </ol> 
                    id:
                      type: string
                      maxLength: 20
                      description: |
                        Identifier of the individual or legal entity. Up to a maximum of 20 characters is allowed.

                        &nbsp;

                        When the country is within the EU and `id_type` equals `02`, i.e., it corresponds to a VAT number, it will be validated by default
                        against the VIES census. If it is not listed, the AEAT will reject the submission.

                        &nbsp;

                        We have an endpoint for VAT validation in the VIES census in the NIF management API.
                        The documentation can be found <a href="https://www.verifacti.com/nifs-docs#tag/NIFs/paths/~1nifs~1validar~1vies/post" target="_blank">here</a>.
                nombre:
                  type: string
                  maxLength: 120
                  example: Customer name
                  description: Full name or company name of the recipient. Required except for simplified invoices (F2, R5).
                validar_destinatario:
                  type: boolean
                  default: true
                  description: |
                    If the `nif` field is included, we validate by default that it is registered with the AEAT, since if it is not, the AEAT will reject the submission. This requires an
                    additional call on our side. If you are sure the recipients' NIFs are registered, you can disable this validation in the test environment by setting
                    this field to `false`.

                    &nbsp;

                    Similarly, if the `id_otro` field is included with `id_type` equal to `02`, we validate by default that the VAT is listed in the VIES census. You can
                    disable this validation in the test environment by setting this field to `false`.
                tipo_rectificativa:
                  type: string
                  enum:
                    - S
                    - I
                  description: |
                    Required and allowed only for corrective invoices (R1, R2, R3, R4, R5). Indicates whether the correction
                    is by substitution (`S`) or by difference (`I`).
                importe_rectificativa:
                  type: object
                  description: Required and allowed only if `tipo_rectificativa` equals `S`.
                  properties:
                    base_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Taxable base of the corrected invoice.
                    cuota_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Output tax of the corrected invoice.
                    cuota_recargo_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Equivalence surcharge tax of the corrected invoice.
                facturas_rectificadas:
                  type: array
                  description: Corrected invoices. Allowed (though not mandatory) for corrective invoices (R1, R2, R3, R4, R5).
                  items:
                    type: object
                    properties:
                      serie:
                        type: string
                        description: Series of the corrected invoice.
                      numero:
                        type: string
                        description: Number of the corrected invoice.
                      fecha_expedicion:
                        type: string
                        pattern: \d{2,2}-\d{2,2}-\d{4,4}
                        description: Issue date of the corrected invoice.
                facturas_sustituidas:
                  type: array
                  description: Replaced invoices. Allowed (though not mandatory) for `F3` type invoices.
                  items:
                    type: object
                    properties:
                      serie:
                        type: string
                        description: Series of the replaced invoice.
                      numero:
                        type: string
                        description: Number of the replaced invoice.
                      fecha_expedicion:
                        type: string
                        pattern: \d{2,2}-\d{2,2}-\d{4,4}
                        description: Issue date of the replaced invoice.
                incidencia:
                  type: string
                  description: Incident indicator. The value `S` must be set if an incident has occurred.
                especial:
                  type: object
                  description: Additional data for invoices.
                  properties:
                    cupon:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is R1 or R5. Not mandatory.
                    factura_simplificada_art_7273:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is F1, F3, R1, R2, R3, or R4.
                    factura_sin_identif_destinatario_art_61d:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is F2 or R5.
                    emitida_por_tercero_o_destinatario:
                      type: string
                      enum:
                        - T
                        - D
                      description: Indicates whether the invoice was issued by a third party or by the recipient.
                    nombre_tercero:
                      type: string
                      maxLength: 120
                      description: Required and allowed only if `emitida_por_tercero_o_destinatario` equals T.
                    nif_tercero:
                      type: string
                      description: Allowed only if `emitida_por_tercero_o_destinatario` equals `T`. Takes precedence over `id_otro_tercero`.
                    id_otro_tercero:
                      type: object
                      description: Allowed only if `emitida_por_tercero_o_destinatario` equals `T`.
                      properties:
                        id_type:
                          type: string
                          enum:
                            - '02'
                            - '03'
                            - '04'
                            - '05'
                            - '06'
                          description: |
                            Identifier type for the individual or legal entity. The different identifier types are:
                            <ol style="list-style: disc;">
                              <li>02: VAT ID (NIF-IVA)</li>
                              <li>03: Passport</li>
                              <li>04: ID in country of residence</li>
                              <li>05: Residence certificate</li>
                              <li>06: Other supporting document</li>
                            </ol>
                        codigo_pais:
                          type: string
                          description: Country code of the individual or legal entity in ISO 3166-1 alpha-2 format. Required except when `id_type` is 02.
                        id:
                          type: string
                          description: Identifier for an individual or legal entity other than the NIF.
              example:
                serie: A
                numero: '234634'
                fecha_expedicion: CURRENT_DATE
                tipo_factura: F1
                descripcion: Operation description
                nif: A15022510
                nombre: Customer name
                lineas:
                  - base_imponible: '200'
                    tipo_impositivo: '21'
                    cuota_repercutida: '42'
                importe_total: '242.00'
            examples:
              factura_normal:
                summary: Normal invoice
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Normal invoice
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  importe_total: '242'
              factura_simplificada:
                summary: Simplified invoice
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F2
                  descripcion: Simplified invoice
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  importe_total: '242'
              mltiples_ivas:
                summary: Multiple VAT rates
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Invoice with multiple VAT rates
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                    - base_imponible: '100'
                      tipo_impositivo: '10'
                      cuota_repercutida: '10'
                  importe_total: '352'
              a_ciudadano_extranjero:
                summary: To foreign citizen
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Normal invoice (passport)
                  id_otro:
                    codigo_pais: DE
                    id_type: '03'
                    id: F8624KW3J6
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  importe_total: '242'
              a_empresa_intracomunitaria:
                summary: To EU company
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Invoice to VIES company
                  id_otro:
                    codigo_pais: BE
                    id_type: '02'
                    id: BE0404621642
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      operacion_exenta: E5
                  importe_total: '200'
              exenta_de_iva:
                summary: VAT exempt
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Exempt operation
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      operacion_exenta: E1
                  importe_total: '200'
              operacin_no_sujeta:
                summary: Non-subject operation
                value:
                  serie: Examples
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Non-subject operation
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      calificacion_operacion: N1
                  importe_total: '200'
              factura_con_igic:
                summary: Invoice with IGIC
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Operation with IGIC
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - impuesto: '03'
                      base_imponible: '200'
                      tipo_impositivo: '7'
                      cuota_repercutida: '14'
                  importe_total: '214'
              factura_con_ipsi:
                summary: Invoice with IPSI
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Operation with IPSI
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - impuesto: '02'
                      base_imponible: '200'
                      tipo_impositivo: '4'
                      cuota_repercutida: '8'
                  importe_total: '208'
              factura_de_abono:
                summary: Credit note
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Credit note
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '-200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '-42'
                  importe_total: '-242'
              factura_de_canje:
                summary: Replacement invoice
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F3
                  descripcion: Operation description
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  facturas_sustituidas:
                    - serie: SIMPLE
                      numero: '1'
                      fecha_expedicion: 19-06-2025
                  importe_total: '242'
              rectificativa_por_sustitucin:
                summary: Corrective by substitution
                value:
                  serie: R
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  fecha_operacion: 01-04-2025
                  tipo_factura: R1
                  tipo_rectificativa: S
                  descripcion: Correction by substitution in one step
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '800'
                      tipo_impositivo: '21'
                      cuota_repercutida: '168'
                  importe_total: '968'
                  importe_rectificativa:
                    base_rectificada: '1000'
                    cuota_rectificada: '210'
                  facturas_rectificadas:
                    - serie: A
                      numero: '1'
                      fecha_expedicion: 07-04-2025
              rectificativa_por_diferencias:
                summary: Corrective by differences
                value:
                  serie: R
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: R1
                  tipo_rectificativa: I
                  descripcion: 'Operation description: correction by differences'
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '-500'
                      tipo_impositivo: '21'
                      cuota_repercutida: '-105'
                  importe_total: '-605'
                  facturas_rectificadas:
                    - serie: A
                      numero: '1'
                      fecha_expedicion: 07-04-2025
              recargo_de_equivalencia:
                summary: Equivalence surcharge
                value:
                  serie: RECARGO
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Operation description
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                      clave_regimen: '18'
                      tipo_recargo_equivalencia: '5.2'
                      cuota_recargo_equivalencia: '10.4'
                  importe_total: '252.4'
              emitida_por_terceros:
                summary: Issued by third party
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Invoice issued by third party
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  especial:
                    emitida_por_tercero_o_destinatario: T
                    nombre_tercero: Third party name
                    nif_tercero: B86561412
                  importe_total: '242'
              emitida_por_destinatario:
                summary: Issued by recipient
                value:
                  serie: A
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Invoice issued by recipient
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  especial:
                    emitida_por_tercero_o_destinatario: D
                  importe_total: '242'
              rgimen_de_bienes_usados:
                summary: Second-hand goods regime
                value:
                  serie: Examples
                  numero: '1'
                  fecha_expedicion: CURRENT_DATE
                  tipo_factura: F1
                  descripcion: Invoice under special regime for second-hand goods (REBU)
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '826.45'
                      tipo_impositivo: '21'
                      cuota_repercutida: '173.55'
                      clave_regimen: '03'
                  importe_total: '3000'
      responses:
        '200':
          description: Invoicing record created. It will be sent to the AEAT in the next few seconds.
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier to check its status.
                    type: string
                    example: b018ced3-b362-4494-8776-9eefff1c160c
                  estado:
                    description: Record status. It will always be "Pendiente" (Pending) as a response to a creation. This status can be subsequently checked with the `/status` endpoint.
                    type: string
                    example: Pendiente
                  url:
                    description: QR code verification URL.
                    type: string
                    example: https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=A15022510&numserie=A234634&fecha=CURRENT_DATE&importe=242
                  qr:
                    description: Base 64 QR code containing the URL.
                    type: string
                    example: jBBWRw0KGgoABAANSUhEAH0CAIAAABE...
                  huella:
                    description: Record fingerprint or hash.
                    type: string
                    example: B11F3A015173AD99075E2720F61E2DE1FF08CBFEDD85C6F73C77AD835301B2A3
        '400':
          description: Error in the request data. The invoicing record is not created and therefore is not sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description
                    type: string
                    example: The tipo_factura field must be F1, F2, R1, R2, R3, R4, R5, or F3.
        '500':
          description: Server error
  /verifactu/create_bulk:
    post:
      summary: Create invoices in bulk
      description: |
        This endpoint creates up to 50 new invoicing records. The request body is simply an array of invoices,
        as they are sent in the `verifactu/create` endpoint. Similarly, the response is an array of objects with the identifiers
        of the created records along with the QR code, URL, and status of each one.

        &nbsp;

        It is important to understand that the fields of each invoice will be validated and, if any error is found, a 400 error will be returned with the
        error message of the invoice that failed. In that case, no invoicing record will be generated and, therefore, no
        communication with the AEAT will be made.

        &nbsp;

        This endpoint also accepts an optional `Idempotency-Key` header. If present, retries of the same batch with the same key replay the original response
        (including the `Idempotent-Replayed: true` response header and the echoed `Idempotency-Key`). The
        key covers the whole batch: the same array of invoices returns the same array of results. Keys are
        scoped per NIF and remembered for 24 hours.
        Reusing the same key with a different body returns 422; a concurrent retry while the first is still
        in flight returns 409.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/create_bulk' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '[
                   {
                     "serie": "B",
                     "numero": "1",
                     "fecha_expedicion": "CURRENT_DATE",
                     "tipo_factura": "F1",
                     "descripcion": "Service provision",
                     "nif": "A15022510",
                     "nombre": "Customer name",
                     "lineas": [
                       {
                         "base_imponible": "200",
                         "tipo_impositivo": "21",
                         "cuota_repercutida": "42"
                       }
                     ],
                     "importe_total": "242.00"
                   },
                   {
                     "serie": "B",
                     "numero": "2",
                     "fecha_expedicion": "CURRENT_DATE",
                     "tipo_factura": "F2",
                     "descripcion": "Sale of goods",
                     "lineas": [
                       {
                         "base_imponible": "300",
                         "tipo_impositivo": "21",
                         "cuota_repercutida": "63"
                       }
                     ],
                     "importe_total": "363.00"
                   }
                 ]'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/create_bulk"

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

            payload = json.loads("""
            [
              {
                "serie": "B",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "descripcion": "Service provision",
                "nif": "A15022510",
                "nombre": "Customer name",
                "lineas": [
                  {
                    "base_imponible": "200",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "42"
                  }
                ],
                "importe_total": "242.00"
              },
              {
                "serie": "B",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "descripcion": "Sale of goods",
                "lineas": [
                  {
                    "base_imponible": "300",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "63"
                  }
                ],
                "importe_total": "363.00"
              }
            ]
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = [
              {
                "serie": "B",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "descripcion": "Service provision",
                "nif": "A15022510",
                "nombre": "Customer name",
                "lineas": [
                  {
                    "base_imponible": "200",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "42"
                  }
                ],
                "importe_total": "242.00"
              },
              {
                "serie": "B",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "descripcion": "Sale of goods",
                "lineas": [
                  {
                    "base_imponible": "300",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "63"
                  }
                ],
                "importe_total": "363.00"
              }
            ];

            const response = await fetch("https://api.verifacti.com/verifactu/create_bulk", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = [
              {
                "serie": "B",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "descripcion": "Service provision",
                "nif": "A15022510",
                "nombre": "Customer name",
                "lineas": [
                  {
                    "base_imponible": "200",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "42"
                  }
                ],
                "importe_total": "242.00"
              },
              {
                "serie": "B",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "descripcion": "Sale of goods",
                "lineas": [
                  {
                    "base_imponible": "300",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "63"
                  }
                ],
                "importe_total": "363.00"
              }
            ];

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            [
              {
                "serie": "B",
                "numero": "1",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F1",
                "descripcion": "Service provision",
                "nif": "A15022510",
                "nombre": "Customer name",
                "lineas": [
                  {
                    "base_imponible": "200",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "42"
                  }
                ],
                "importe_total": "242.00"
              },
              {
                "serie": "B",
                "numero": "2",
                "fecha_expedicion": "CURRENT_DATE",
                "tipo_factura": "F2",
                "descripcion": "Sale of goods",
                "lineas": [
                  {
                    "base_imponible": "300",
                    "tipo_impositivo": "21",
                    "cuota_repercutida": "63"
                  }
                ],
                "importe_total": "363.00"
              }
            ]
            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    \"serie\": \"B\",\n    \"numero\": \"1\",\n    \"fecha_expedicion\": \"CURRENT_DATE\",\n    \"tipo_factura\": \"F1\",\n    \"descripcion\": \"Service provision\",\n    \"nif\": \"A15022510\",\n    \"nombre\": \"Customer name\",\n    \"lineas\": [\n      {\n        \"base_imponible\": \"200\",\n        \"tipo_impositivo\": \"21\",\n        \"cuota_repercutida\": \"42\"\n      }\n    ],\n    \"importe_total\": \"242.00\"\n  },\n  {\n    \"serie\": \"B\",\n    \"numero\": \"2\",\n    \"fecha_expedicion\": \"CURRENT_DATE\",\n    \"tipo_factura\": \"F2\",\n    \"descripcion\": \"Sale of goods\",\n    \"lineas\": [\n      {\n        \"base_imponible\": \"300\",\n        \"tipo_impositivo\": \"21\",\n        \"cuota_repercutida\": \"63\"\n      }\n    ],\n    \"importe_total\": \"363.00\"\n  }\n]\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            [
                              {
                                "serie": "B",
                                "numero": "1",
                                "fecha_expedicion": "CURRENT_DATE",
                                "tipo_factura": "F1",
                                "descripcion": "Service provision",
                                "nif": "A15022510",
                                "nombre": "Customer name",
                                "lineas": [
                                  {
                                    "base_imponible": "200",
                                    "tipo_impositivo": "21",
                                    "cuota_repercutida": "42"
                                  }
                                ],
                                "importe_total": "242.00"
                              },
                              {
                                "serie": "B",
                                "numero": "2",
                                "fecha_expedicion": "CURRENT_DATE",
                                "tipo_factura": "F2",
                                "descripcion": "Sale of goods",
                                "lineas": [
                                  {
                                    "base_imponible": "300",
                                    "tipo_impositivo": "21",
                                    "cuota_repercutida": "63"
                                  }
                                ],
                                "importe_total": "363.00"
                              }
                            ]
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        [
                          {
                            ""serie"": ""B"",
                            ""numero"": ""1"",
                            ""fecha_expedicion"": ""CURRENT_DATE"",
                            ""tipo_factura"": ""F1"",
                            ""descripcion"": ""Service provision"",
                            ""nif"": ""A15022510"",
                            ""nombre"": ""Customer name"",
                            ""lineas"": [
                              {
                                ""base_imponible"": ""200"",
                                ""tipo_impositivo"": ""21"",
                                ""cuota_repercutida"": ""42""
                              }
                            ],
                            ""importe_total"": ""242.00""
                          },
                          {
                            ""serie"": ""B"",
                            ""numero"": ""2"",
                            ""fecha_expedicion"": ""CURRENT_DATE"",
                            ""tipo_factura"": ""F2"",
                            ""descripcion"": ""Sale of goods"",
                            ""lineas"": [
                              {
                                ""base_imponible"": ""300"",
                                ""tipo_impositivo"": ""21"",
                                ""cuota_repercutida"": ""63""
                              }
                            ],
                            ""importe_total"": ""363.00""
                          }
                        ]
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "[" & vbCrLf & _
                   "  {" & vbCrLf & _
                   "    ""serie"": ""B""," & vbCrLf & _
                   "    ""numero"": ""1""," & vbCrLf & _
                   "    ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "    ""tipo_factura"": ""F1""," & vbCrLf & _
                   "    ""descripcion"": ""Service provision""," & vbCrLf & _
                   "    ""nif"": ""A15022510""," & vbCrLf & _
                   "    ""nombre"": ""Customer name""," & vbCrLf & _
                   "    ""lineas"": [" & vbCrLf & _
                   "      {" & vbCrLf & _
                   "        ""base_imponible"": ""200""," & vbCrLf & _
                   "        ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "        ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "      }" & vbCrLf & _
                   "    ]," & vbCrLf & _
                   "    ""importe_total"": ""242.00""" & vbCrLf & _
                   "  }," & vbCrLf & _
                   "  {" & vbCrLf & _
                   "    ""serie"": ""B""," & vbCrLf & _
                   "    ""numero"": ""2""," & vbCrLf & _
                   "    ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "    ""tipo_factura"": ""F2""," & vbCrLf & _
                   "    ""descripcion"": ""Sale of goods""," & vbCrLf & _
                   "    ""lineas"": [" & vbCrLf & _
                   "      {" & vbCrLf & _
                   "        ""base_imponible"": ""300""," & vbCrLf & _
                   "        ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "        ""cuota_repercutida"": ""63""" & vbCrLf & _
                   "      }" & vbCrLf & _
                   "    ]," & vbCrLf & _
                   "    ""importe_total"": ""363.00""" & vbCrLf & _
                   "  }" & 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 that guarantees retries of the same request don't create duplicates. Printable ASCII string, 1–255 characters. Remembered per NIF for 24 hours.
          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: 50
              items:
                type: object
                description: Each element of the array has the format described in the invoice creation endpoint.
              example:
                - serie: B
                  numero: '1'
                  fecha_expedicion: 02-06-2025
                  tipo_factura: F1
                  descripcion: Service provision
                  nif: A15022510
                  nombre: Customer name
                  lineas:
                    - base_imponible: '200'
                      tipo_impositivo: '21'
                      cuota_repercutida: '42'
                  importe_total: '242.00'
                - serie: B
                  numero: '2'
                  fecha_expedicion: 02-06-2025
                  tipo_factura: F2
                  descripcion: Sale of goods
                  lineas:
                    - base_imponible: '300'
                      tipo_impositivo: '21'
                      cuota_repercutida: '63'
                  importe_total: '363.00'
      responses:
        '200':
          description: Invoicing records created. They will be sent to the AEAT in the next few seconds.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    uuid:
                      description: Unique record identifier to check its status.
                      type: string
                    estado:
                      description: Record status. It will always be "Pendiente" (Pending) as a response to a creation. This status can be subsequently checked with the `/status` endpoint.
                      type: string
                    url:
                      description: QR code verification URL.
                      type: string
                    qr:
                      description: Base 64 QR code containing the URL.
                      type: string
                    huella:
                      description: Record fingerprint or hash.
                      type: string
                      example: B11F3A015173AD99075E2720F61E2DE1FF08CBFEDD85C6F73C77AD835301B2A3
                example:
                  - uuid: 6c7e5d2c-6c7e-5d2c-6c7e-5d2c6c7e5d2c
                    estado: Pendiente
                    url: https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=A15022510&numserie=B1&fecha=02-06-2025&importe=242
                    qr: iVBORw0KGgoAAAANSUhEUgAAA...
                  - uuid: 4cdfe3d2d-4d5f-fd2c-7c72-2d4c5d3e5d1d
                    estado: Pendiente
                    url: https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=A15022510&numserie=B2&fecha=02-06-2025&importe=363
                    qr: iVBORw0KGgoAAAANSUhEUgAAA...
        '400':
          description: Error in the request data. No invoicing records are generated and therefore none are sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description
                    type: string
                    example: 'Error in invoice 2: The tipo_factura field must be F1, F2, R1, R2, R3, R4, R5, or F3.'
        '500':
          description: Server error
  /verifactu/modify:
    put:
      summary: Amend invoice
      description: |
        This endpoint allows you to submit a invoicing record to modify or amend an existing invoice when
        the issuance of a corrective invoice is not required (or another mechanism provided for in the Invoicing Regulation).
        When doing so, the record is queued to be sent to the AEAT.

        &nbsp;

        To create a corrective invoice, use the POST `/create` endpoint with the appropriate `tipo_factura`.

        &nbsp;

        This endpoint also accepts an optional `Idempotency-Key` header. If present, 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 scoped per NIF and remembered for 24 hours.
        Reusing the same key with a different body returns 422; a concurrent retry while the first is still
        in flight returns 409.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X PUT 'https://api.verifacti.com/verifactu/modify' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "rechazo_previo": "N",
                   "serie": "A",
                   "numero": "234634",
                   "fecha_expedicion": "CURRENT_DATE",
                   "tipo_factura": "F1",
                   "descripcion": "Operation description",
                   "nif": "A15022510",
                   "nombre": "Customer name",
                   "lineas": [
                     {
                       "base_imponible": "200",
                       "tipo_impositivo": "21",
                       "cuota_repercutida": "42"
                     }
                   ],
                   "importe_total": "242"
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/modify"

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

            payload = json.loads("""
            {
              "rechazo_previo": "N",
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            }
            """)

            response = requests.put(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "rechazo_previo": "N",
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/modify", {
              method: "PUT",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "rechazo_previo": "N",
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "cuota_repercutida": "42"
                }
              ],
              "importe_total": "242"
            };

            const response = await axios.put("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "rechazo_previo": "N",
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE",
              "tipo_factura": "F1",
              "descripcion": "Operation description",
              "nif": "A15022510",
              "nombre": "Customer name",
              "lineas": [
                {
                  "base_imponible": "200",
                  "tipo_impositivo": "21",
                  "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  \"rechazo_previo\": \"N\",\n  \"serie\": \"A\",\n  \"numero\": \"234634\",\n  \"fecha_expedicion\": \"CURRENT_DATE\",\n  \"tipo_factura\": \"F1\",\n  \"descripcion\": \"Operation description\",\n  \"nif\": \"A15022510\",\n  \"nombre\": \"Customer name\",\n  \"lineas\": [\n    {\n      \"base_imponible\": \"200\",\n      \"tipo_impositivo\": \"21\",\n      \"cuota_repercutida\": \"42\"\n    }\n  ],\n  \"importe_total\": \"242\"\n}\n`\n\n\treq, err := http.NewRequest(\"PUT\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "rechazo_previo": "N",
                              "serie": "A",
                              "numero": "234634",
                              "fecha_expedicion": "CURRENT_DATE",
                              "tipo_factura": "F1",
                              "descripcion": "Operation description",
                              "nif": "A15022510",
                              "nombre": "Customer name",
                              "lineas": [
                                {
                                  "base_imponible": "200",
                                  "tipo_impositivo": "21",
                                  "cuota_repercutida": "42"
                                }
                              ],
                              "importe_total": "242"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/modify"))
                        .header("Authorization", "Bearer <API_KEY>")
                        .header("Content-Type", "application/json")
                        .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 = @"
                        {
                          ""rechazo_previo"": ""N"",
                          ""serie"": ""A"",
                          ""numero"": ""234634"",
                          ""fecha_expedicion"": ""CURRENT_DATE"",
                          ""tipo_factura"": ""F1"",
                          ""descripcion"": ""Operation description"",
                          ""nif"": ""A15022510"",
                          ""nombre"": ""Customer name"",
                          ""lineas"": [
                            {
                              ""base_imponible"": ""200"",
                              ""tipo_impositivo"": ""21"",
                              ""cuota_repercutida"": ""42""
                            }
                          ],
                          ""importe_total"": ""242""
                        }
                    ";

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

                    var response = await client.PutAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""rechazo_previo"": ""N""," & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""234634""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""," & vbCrLf & _
                   "  ""tipo_factura"": ""F1""," & vbCrLf & _
                   "  ""descripcion"": ""Operation description""," & vbCrLf & _
                   "  ""nif"": ""A15022510""," & vbCrLf & _
                   "  ""nombre"": ""Customer name""," & vbCrLf & _
                   "  ""lineas"": [" & vbCrLf & _
                   "    {" & vbCrLf & _
                   "      ""base_imponible"": ""200""," & vbCrLf & _
                   "      ""tipo_impositivo"": ""21""," & vbCrLf & _
                   "      ""cuota_repercutida"": ""42""" & vbCrLf & _
                   "    }" & vbCrLf & _
                   "  ]," & vbCrLf & _
                   "  ""importe_total"": ""242""" & 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 that guarantees retries of the same request don't create duplicates. Printable ASCII string, 1–255 characters. Remembered per NIF for 24 hours.
          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:
                - serie
                - numero
                - fecha_expedicion
                - tipo_factura
                - descripcion
                - lineas
                - importe_total
              properties:
                serie:
                  type: string
                  example: A
                  description: Invoice series. If no series is desired, an empty string can be sent. It must not begin with a blank space. The concatenation of the series and number fields cannot exceed 60 characters.
                numero:
                  type: string
                  example: '234634'
                  description: Invoice number. The concatenation of the series and number fields cannot exceed 60 characters.
                fecha_expedicion:
                  type: string
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  example: CURRENT_DATE
                  description: Invoice issue date. Cannot be a date later than the current date.
                rechazo_previo:
                  type: string
                  enum:
                    - 'N'
                    - S
                    - X
                  example: 'N'
                  default: 'N'
                  description: |
                    This field indicates whether the invoice to be amended was previously rejected by the AEAT.

                    In the most common case of amending an invoice that was accepted by the AEAT, set to `N`. If, on the contrary, the
                    initial registration was rejected, set this field to `X`. Finally, if what was rejected was the amendment of the invoice, set to `S`.
                tipo_factura:
                  type: string
                  example: F1
                  enum:
                    - F1
                    - F2
                    - R1
                    - R2
                    - R3
                    - R4
                    - R5
                    - F3
                  description: |
                    The different invoice types are:
                    <ol style="list-style: disc;">
                      <li>F1: Invoice (Art. 6, 7.2 and 7.3 of RD 1619/2012)</li>
                      <li>F2: Simplified invoice and invoices without recipient identification (Art. 6.1.D RD 1619/2012)</li>
                      <li>R1: Corrective invoice (Art. 80.1 and 80.2 and error based on law)</li>
                      <li>R2: Corrective invoice (Art. 80.3)</li>
                      <li>R3: Corrective invoice (Art. 80.4)</li>
                      <li>R4: Corrective invoice (Other)</li>
                      <li>R5: Corrective invoice for simplified invoices (Art. 80.3)</li>
                      <li>F3: Invoice issued as replacement for billed and declared simplified invoices</li>
                    </ol>
                descripcion:
                  type: string
                  example: Operation description
                  minLength: 1
                  maxLength: 500
                  description: Operation description.
                lineas:
                  type: array
                  minItems: 1
                  maxItems: 12
                  description: |
                    Invoice lines. Accepts up to a maximum of 12 lines, a restriction imposed by the Tax Agency API.
                    Each line can have a different VAT rate, therefore, it is expected that different elements of
                    an invoice with the same VAT rate are grouped into a single line. Otherwise, it would be common to exceed the 12-line limit.
                  items:
                    $ref: '#/components/schemas/lineas'
                importe_total:
                  type: string
                  pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                  description: |
                    Total invoice amount. It will be validated to equal the sum of (`base_imponible` + `cuota_repercutida` + 
                    `cuota_recargo_equivalencia`) of all lines with an allowed margin of error of +/- €10.00. This validation will not
                    be applied when `clave_regimen` is 03, 05, 06, 08, or 09.
                  example: '242.00'
                fecha_operacion:
                  type: string
                  pattern: \d{2,2}-\d{2,2}-\d{4,4}
                  description: Operation date.
                nif:
                  type: string
                  example: A15022510
                  description: |
                    Recipient's NIF (tax ID). Required except for simplified invoices (F2, R5) or when the `id_otro` field is included.
                    If both `nif` and `id_otro` are included, `nif` will be used.

                    &nbsp;

                    If the `nif` field is included, we validate by default that it is registered with the AEAT, since if it is not, the AEAT will reject the submission. If
                    not registered, a 400 error will be returned, meaning the invoicing record has not been generated and no submission to the AEAT will occur.

                    &nbsp;

                    For legal entities, it is sufficient for the NIF to be registered. For individuals, the NIF must be registered and the `nombre` must be
                    sufficiently similar to the name in the census.

                    &nbsp;

                    We have an endpoint to validate the NIF of individuals and legal entities in the NIF management API. The documentation can be found
                    <a href="https://www.verifacti.com/nifs-docs#tag/NIFs/paths/~1nifs~1validar/post" target="_blank">here</a>.
                id_otro:
                  type: object
                  description: |
                    Identifier for an individual or legal entity other than the NIF. Required except for simplified invoices (F2, R5) or when
                    the `nif` field is included. If both `nif` and `id_otro` are included, `nif` will be used.

                    &nbsp;

                    If the `codigo_pais` field equals ES, the `id_type` field will be validated to be 03 or 07. If the `id_type` field is 07,
                    the `codigo_pais` field will be validated to be ES.
                  properties:
                    codigo_pais:
                      type: string
                      description: Country code of the individual or legal entity in ISO 3166-1 alpha-2 format. Required except when `id_type` is 02.
                    id_type:
                      type: string
                      enum:
                        - '02'
                        - '03'
                        - '04'
                        - '05'
                        - '06'
                        - '07'
                      description: |
                        Identifier type for the individual or legal entity. The different identifier types are:
                        <ol style="list-style: disc;">
                          <li>02: VAT ID (NIF-IVA)</li>
                          <li>03: Passport</li>
                          <li>04: ID in country of residence</li>
                          <li>05: Residence certificate</li>
                          <li>06: Other supporting document</li>
                          <li>07: Not registered</li>
                        </ol> 
                    id:
                      type: string
                      maxLength: 20
                      description: |
                        Identifier of the individual or legal entity. Up to a maximum of 20 characters is allowed.

                        &nbsp;

                        When the country is within the EU and `id_type` equals `02`, i.e., it corresponds to a VAT number, it will be validated by default
                        against the VIES census. If it is not listed, the AEAT will reject the submission.

                        &nbsp;

                        We have an endpoint for VAT validation in the VIES census in the NIF management API.
                        The documentation can be found <a href="https://www.verifacti.com/nifs-docs#tag/NIFs/paths/~1nifs~1validar~1vies/post" target="_blank">here</a>.
                nombre:
                  type: string
                  example: Customer name
                  description: Full name or company name of the recipient. Required except for simplified invoices (F2, R5).
                validar_destinatario:
                  type: boolean
                  default: true
                  description: |
                    If the `nif` field is included, we validate by default that it is registered with the AEAT, since if it is not, the AEAT will reject the submission. This requires an
                    additional call on our side. If you are sure the recipients' NIFs are registered, you can disable this validation in the test environment by setting
                    this field to `false`.

                    &nbsp;

                    Similarly, if the `id_otro` field is included with `id_type` equal to `02` and `codigo_pais` of an EU country, we validate by default that
                    the VAT is listed in the VIES census. You can disable this validation in the test environment by setting this field to `false`.
                tipo_rectificativa:
                  type: string
                  enum:
                    - S
                    - I
                  description: |
                    Required and allowed only for corrective invoices (R1, R2, R3, R4, R5). Indicates whether the correction
                    is by substitution (`S`) or by difference (`I`).
                importe_rectificativa:
                  type: object
                  description: Required and allowed only if `tipo_rectificativa` equals `S`.
                  properties:
                    base_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Taxable base of the corrected invoice.
                    cuota_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Output tax of the corrected invoice.
                    cuota_recargo_rectificada:
                      type: string
                      pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
                      description: Equivalence surcharge tax of the corrected invoice.
                facturas_rectificadas:
                  type: array
                  description: Corrected invoices. Allowed (though not mandatory) for corrective invoices (R1, R2, R3, R4, R5).
                  items:
                    type: object
                    properties:
                      serie:
                        type: string
                        description: Series of the corrected invoice.
                      numero:
                        type: string
                        description: Number of the corrected invoice.
                      fecha_expedicion:
                        type: string
                        description: Issue date of the corrected invoice.
                facturas_sustituidas:
                  type: array
                  description: Replaced invoices. Allowed (though not mandatory) for `F3` type invoices.
                  items:
                    type: object
                    properties:
                      serie:
                        type: string
                        description: Series of the replaced invoice.
                      numero:
                        type: string
                        description: Number of the replaced invoice.
                      fecha_expedicion:
                        type: string
                        description: Issue date of the replaced invoice.
                incidencia:
                  type: string
                  description: Incident indicator. The value `S` must be set if an incident has occurred.
                especial:
                  type: object
                  description: Additional data for invoices.
                  properties:
                    cupon:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is R1 or R5. Not mandatory.
                    factura_simplificada_art_7273:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is "F1”, "F3”, "R1”, "R2”, "R3”, or "R4".
                    factura_sin_identif_destinatario_art_61d:
                      type: string
                      enum:
                        - S
                      description: Can only be filled with `S` if the invoice type is "F2” or "R5".
                    emitida_por_tercero_o_destinatario:
                      type: string
                      enum:
                        - T
                        - D
                      description: Indicates whether the invoice was issued by a third party or by the recipient.
                    nombre_tercero:
                      type: string
                      maxLength: 120
                      description: Required and allowed only if `emitida_por_tercero_o_destinatario` equals `T`.
                    nif_tercero:
                      type: string
                      description: Allowed only if `emitida_por_tercero_o_destinatario` equals `T`. Takes precedence over `id_otro_tercero`.
                    id_otro_tercero:
                      type: object
                      description: Allowed only if `emitida_por_tercero_o_destinatario` equals `T`.
                      properties:
                        id_type:
                          type: string
                          enum:
                            - '02'
                            - '03'
                            - '04'
                            - '05'
                            - '06'
                          description: |
                            Identifier type for the individual or legal entity. The different identifier types are:
                            <ol style="list-style: disc;">
                              <li>02: VAT ID (NIF-IVA)</li>
                              <li>03: Passport</li>
                              <li>04: ID in country of residence</li>
                              <li>05: Residence certificate</li>
                              <li>06: Other supporting document</li>
                            </ol>
                        codigo_pais:
                          type: string
                          description: Country code of the individual or legal entity in ISO 3166-1 alpha-2 format. Required except when `id_type` is 02.
                        id:
                          type: string
                          description: Identifier for an individual or legal entity other than the NIF.
              example:
                serie: A
                numero: '234634'
                fecha_expedicion: CURRENT_DATE
                tipo_factura: F1
                descripcion: Operation description
                nif: A15022510
                nombre: Customer name
                lineas:
                  - base_imponible: '200'
                    tipo_impositivo: '21'
                    cuota_repercutida: '42'
                importe_total: '242.00'
      responses:
        '200':
          description: Invoicing record created. It will be sent to the AEAT in the next few seconds.
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier to check its status.
                    type: string
                    example: b018ced3-b362-4494-8776-9eefff1c160c
                  estado:
                    description: Record status. It will always be "Pendiente" (Pending) as a response to a creation. This status can be subsequently checked with the `/status` endpoint.
                    type: string
                    example: Pendiente
                  url:
                    description: QR code verification URL.
                    type: string
                    example: https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=A15022510&numserie=A234634&fecha=CURRENT_DATE&importe=242
                  qr:
                    description: Base 64 QR code containing the URL.
                    type: string
                    example: jBBWRw0KGgoABAANSUhEAH0CAIAAABE...
        '400':
          description: Error in the request data. The invoicing record is not created and therefore is not sent to the AEAT.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: Error description
                    type: string
                    example: The tipo_factura field must be F1, F2, R1, R2, R3, R4, R5, or F3.
        '500':
          description: Server error
  /verifactu/cancel:
    post:
      summary: Cancel invoice
      description: |
        This endpoint allows you to cancel existing invoices. When doing so, the updated information is sent to the AEAT. Once an invoice is cancelled, a
        new one cannot be created with the same (`serie`, `numero`, `fecha_expedicion`).

        &nbsp;

        This endpoint also accepts an optional `Idempotency-Key` header. If present, 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 scoped per NIF and remembered for 24 hours.
        Reusing the same key with a different body returns 422; a concurrent retry while the first is still
        in flight returns 409.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/cancel' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "234634",
                   "fecha_expedicion": "CURRENT_DATE"
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/cancel"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/cancel", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "234634",
              "fecha_expedicion": "CURRENT_DATE"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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'
            {
              "serie": "A",
              "numero": "234634",
              "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  \"serie\": \"A\",\n  \"numero\": \"234634\",\n  \"fecha_expedicion\": \"CURRENT_DATE\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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 = """
                            {
                              "serie": "A",
                              "numero": "234634",
                              "fecha_expedicion": "CURRENT_DATE"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""234634"",
                          ""fecha_expedicion"": ""CURRENT_DATE""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""234634""," & vbCrLf & _
                   "  ""fecha_expedicion"": ""CURRENT_DATE""" & 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 that guarantees retries of the same request don't create duplicates. Printable ASCII string, 1–255 characters. Remembered per NIF for 24 hours.
          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:
                - serie
                - numero
                - fecha_expedicion
              properties:
                serie:
                  type: string
                  description: Invoice series. If no series is desired, an empty string can be sent. It must not begin with a blank space. The concatenation of the series and number fields cannot exceed 60 characters.
                numero:
                  type: string
                  description: Invoice number. The concatenation of the series and number fields cannot exceed 60 characters.
                fecha_expedicion:
                  type: string
                  pattern: ^\d{2}-\d{2}-\d{4}$
                  description: Invoice issue date. Cannot be a date later than the current date.
                rechazo_previo:
                  type: string
                  enum:
                    - 'N'
                    - S
                  default: 'N'
                  description: |
                    This field indicates whether the invoice to be cancelled was previously rejected by the AEAT.

                    In the common case of cancelling an invoice that was accepted by the AEAT, set to `N`. If, on the contrary, the cancellation
                    was rejected, set this field to `S`.
                sin_registro_previo:
                  type: string
                  enum:
                    - 'N'
                    - S
                  default: 'N'
                  description: |
                    This field indicates whether the invoice to be cancelled exists in the AEAT.

                    In the most common case of cancelling an invoice that is registered with the AEAT, set to `N`. If, on the contrary, the invoice
                    to be cancelled is not registered with the AEAT, set to `S`.
                incidencia:
                  type: string
                  description: Incident indicator. The value `S` must be set if an incident has occurred.
              example:
                serie: A
                numero: '234634'
                fecha_expedicion: CURRENT_DATE
      responses:
        '200':
          description: Invoice cancelled
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    description: Unique record identifier to check its status.
                    type: string
                    example: b018ced3-b362-4494-8776-9eefff1c160c
                  huella:
                    description: Record fingerprint or hash.
                    type: string
                    example: B11F3A015173AD99075E2720F61E2DE1FF08CBFEDD85C6F73C77AD835301B2A3
                  estado:
                    description: Record status.
                    type: string
                    example: Pendiente
              example:
                estado: Pendiente
                huella: B11F3A015173AD99075E2720F61E2DE1FF08CBFEDD85C6F73C77AD835301B2A3
                uuid: b018ced3-b362-4494-8776-9eefff1c160c
        '500':
          description: Server error
  /verifactu/list:
    post:
      summary: List invoices
      description: |
        This endpoint allows you to query all invoices submitted to the AEAT. A single record is returned
        per invoice (`serie`, `numero` and `fecha_expedicion`) with the latest status in the tax agency
        system.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/list' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "ejercicio": "2024",
                   "periodo": "12",
                   "rango_fecha_expedicion": {
                     "desde": "01-12-2024",
                     "hasta": "04-12-2024"
                   }
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/list"

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

            payload = json.loads("""
            {
              "ejercicio": "2024",
              "periodo": "12",
              "rango_fecha_expedicion": {
                "desde": "01-12-2024",
                "hasta": "04-12-2024"
              }
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "ejercicio": "2024",
              "periodo": "12",
              "rango_fecha_expedicion": {
                "desde": "01-12-2024",
                "hasta": "04-12-2024"
              }
            };

            const response = await fetch("https://api.verifacti.com/verifactu/list", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "2024",
              "periodo": "12",
              "rango_fecha_expedicion": {
                "desde": "01-12-2024",
                "hasta": "04-12-2024"
              }
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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": "2024",
              "periodo": "12",
              "rango_fecha_expedicion": {
                "desde": "01-12-2024",
                "hasta": "04-12-2024"
              }
            }
            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\": \"2024\",\n  \"periodo\": \"12\",\n  \"rango_fecha_expedicion\": {\n    \"desde\": \"01-12-2024\",\n    \"hasta\": \"04-12-2024\"\n  }\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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": "2024",
                              "periodo": "12",
                              "rango_fecha_expedicion": {
                                "desde": "01-12-2024",
                                "hasta": "04-12-2024"
                              }
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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"": ""2024"",
                          ""periodo"": ""12"",
                          ""rango_fecha_expedicion"": {
                            ""desde"": ""01-12-2024"",
                            ""hasta"": ""04-12-2024""
                          }
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

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

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""ejercicio"": ""2024""," & vbCrLf & _
                   "  ""periodo"": ""12""," & vbCrLf & _
                   "  ""rango_fecha_expedicion"": {" & vbCrLf & _
                   "    ""desde"": ""01-12-2024""," & vbCrLf & _
                   "    ""hasta"": ""04-12-2024""" & vbCrLf & _
                   "  }" & 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
              example:
                ejercicio: '2024'
                periodo: '12'
                rango_fecha_expedicion:
                  desde: 01-12-2024
                  hasta: 04-12-2024
              required:
                - ejercicio
                - periodo
              properties:
                ejercicio:
                  type: string
                  description: Fiscal year of the operation date or, failing that, the issue date.
                periodo:
                  type: string
                  description: Period of the operation date or, failing that, the issue date.
                serie:
                  type: string
                  description: Invoice series. Required if `numero` is included.
                numero:
                  type: string
                  description: Invoice number. Required if `serie` is included.
                rango_fecha_expedicion:
                  type: object
                  description: |
                    Issue date range of the invoices to be queried.
                    Takes priority over `fecha_expedicion`.
                  properties:
                    desde:
                      type: string
                      pattern: ^\d{2}-\d{2}-\d{4}$
                      description: Start date of the issue date range of the invoices to be queried.
                    hasta:
                      type: string
                      pattern: ^\d{2}-\d{2}-\d{4}$
                      description: |
                        End date of the issue date range of the invoices to be queried.
                        Must be greater than `desde`.
                fecha_expedicion:
                  type: string
                  pattern: ^\d{2}-\d{2}-\d{4}$
                  description: Issue date of the invoices to be queried.
                paginacion:
                  type: object
                  description: |
                    If the number of invoices to query exceeds 10,000 records, the
                    data from the last queried invoice must be included to obtain the next page.
                  properties:
                    num_serie:
                      type: string
                      description: Concatenation of the series and number of the last invoice obtained.
                    fecha_expedicion:
                      type: string
                      pattern: ^\d{2}-\d{2}-\d{4}$
                      description: Issue date of the last invoice obtained.
      responses:
        '200':
          description: Invoice list
          content:
            application/json:
              schema:
                type: object
                properties:
                  paginacion:
                    type: string
                    enum:
                      - 'N'
                      - S
                    description: |
                      Indicates whether the number of invoices to query exceeds 10,000 records (`S`).
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/estadoFactura'
  /verifactu/export:
    post:
      summary: Export XMLs
      description: |
        This endpoint allows you to export the XML files in batches, both request and response, of invoices submitted to the AEAT.
        This endpoint contains the XMLs that have been sent to the AEAT and their responses without any processing. Therefore, each
        response XML file may contain the response for more than one invoicing record.

        &nbsp;

        The way to download the files is by specifying the fiscal year and the period in which these records were generated.
        Our API response consists of a list of URLs containing the XML files of the invoices. These URLs have an
        expiration of 15 minutes. Each call returns a maximum of 500 URLs and, if there are more, a pagination token is returned.
        This token must be used in the next call to obtain the remaining URLs.

        &nbsp;

        In the test environment, XMLs will be stored for a maximum of 90 days.
        However, the invoice query endpoints will have historical data since they query the AEAT.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/export' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "ejercicio": "2024",
                   "periodo": "12",
                   "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/export"

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

            payload = json.loads("""
            {
              "ejercicio": "2024",
              "periodo": "12",
              "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "ejercicio": "2024",
              "periodo": "12",
              "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
            };

            const response = await fetch("https://api.verifacti.com/verifactu/export", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "ejercicio": "2024",
              "periodo": "12",
              "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/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/verifactu/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": "2024",
              "periodo": "12",
              "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
            }
            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\": \"2024\",\n  \"periodo\": \"12\",\n  \"token\": \"CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD...\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/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": "2024",
                              "periodo": "12",
                              "token": "CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD..."
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/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"": ""2024"",
                          ""periodo"": ""12"",
                          ""token"": ""CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD...""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/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

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

            sUrl = "https://api.verifacti.com/verifactu/export"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""ejercicio"": ""2024""," & vbCrLf & _
                   "  ""periodo"": ""12""," & vbCrLf & _
                   "  ""token"": ""CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD...""" & 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
              example:
                ejercicio: '2024'
                periodo: '12'
                token: CkJ0ZXN0L0I3NTc3Nzg0Ny8yMD...
              required:
                - ejercicio
                - periodo
              properties:
                ejercicio:
                  type: string
                  description: Fiscal year of the date when the invoicing record was generated. It does not necessarily match the issue or operation date.
                periodo:
                  type: string
                  description: Period of the date when the invoicing record was generated. It does not necessarily match the issue or operation date.
                token:
                  type: string
                  description: Pagination token.
      responses:
        '200':
          description: List of XML files.
          content:
            application/json:
              schema:
                type: object
                properties:
                  urls:
                    type: array
                    description: |
                      Array with the URLs of the invoice XML files. These URLs expire after 15 minutes.
                    maxItems: 500
                    items:
                      type: string
                      format: uri
                      description: URL of the invoice XML files.
                    example:
                      - https://bucket/url_1_req.xml
                      - https://bucket/url_1_res.xml
                      - ...
                  token:
                    type: string
                    description: Pagination token to get the next page.
                    example: BkJ1ZXH0L5I3HTc7Nzg0Ny8ynH...
  /verifactu/downloadXML:
    post:
      summary: Download XML
      description: |
        This endpoint allows you to download the XML files of invoices submitted to the AEAT.

        &nbsp;

        The way to access the XML files is by the invoice series and number. Since it is possible that
        for the same series and number there may be several different records (registration and cancellation, for example), the response
        is, in general, an array of XML files as shown in the example.

        &nbsp;

        On the other hand, due to restrictions imposed by the AEAT API, it is possible that several different billing
        records are sent in the same XML file. This endpoint returns the request and response XML file as sent
        to or received from the AEAT. This means it could include invoicing records related to another invoice series or number.

        &nbsp;

        In the test environment, XMLs will be stored for a maximum of 90 days.
        However, the invoice query endpoints will have historical data since they query the AEAT.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.verifacti.com/verifactu/downloadXML' \
              -H 'Authorization: Bearer <API_KEY>' \
              -H 'Content-Type: application/json' \
              -d '{
                   "serie": "A",
                   "numero": "234634"
                 }'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/downloadXML"

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

            payload = json.loads("""
            {
              "serie": "A",
              "numero": "234634"
            }
            """)

            response = requests.post(url, json=payload, headers=headers)

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const body = {
              "serie": "A",
              "numero": "234634"
            };

            const response = await fetch("https://api.verifacti.com/verifactu/downloadXML", {
              method: "POST",
              headers: {
                "Authorization": "Bearer <API_KEY>",
                "Content-Type": "application/json"
              },
              body: JSON.stringify(body)
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

            const data = {
              "serie": "A",
              "numero": "234634"
            };

            const response = await axios.post("https://api.verifacti.com/verifactu/downloadXML", 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/verifactu/downloadXML";

            $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'
            {
              "serie": "A",
              "numero": "234634"
            }
            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  \"serie\": \"A\",\n  \"numero\": \"234634\"\n}\n`\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.verifacti.com/verifactu/downloadXML\", 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 = """
                            {
                              "serie": "A",
                              "numero": "234634"
                            }
                            """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.verifacti.com/verifactu/downloadXML"))
                        .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 = @"
                        {
                          ""serie"": ""A"",
                          ""numero"": ""234634""
                        }
                    ";

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

                    var response = await client.PostAsync("https://api.verifacti.com/verifactu/downloadXML", 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

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

            sUrl = "https://api.verifacti.com/verifactu/downloadXML"

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

            Dim sBody As String
            sBody = "{" & vbCrLf & _
                   "  ""serie"": ""A""," & vbCrLf & _
                   "  ""numero"": ""234634""" & 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:
                - serie
                - numero
              properties:
                serie:
                  type: string
                  example: A
                  description: Invoice series.
                numero:
                  type: string
                  example: '234634'
                  description: Invoice number.
      responses:
        '200':
          description: XML files
          content:
            application/json:
              schema:
                type: array
                items:
                  properties:
                    uuid:
                      description: Unique record identifier.
                      type: string
                      example: b018ced3-b362-4494-8776-9eefff1c160c
                    operacion:
                      description: Operation type.
                      type: string
                      example: Alta inicial
                    xml_req:
                      description: Request XML file sent to the AEAT.
                      type: string
                      example: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope ...
                    xml_res:
                      description: Response XML file from the AEAT.
                      type: string
                      example: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env=...
                example:
                  - uuid: b018ced3-b362-4494-8776-9eefff1c160c
                    operacion: Alta inicial
                    xml_req: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope ...
                    xml_res: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env=...
        '500':
          description: Server error
  /verifactu/declaracion:
    get:
      summary: Responsible declaration
      description: |
        This endpoint allows you to obtain the responsible declaration from Verifacti. It is also available <a href="https://storage.googleapis.com/verifacti_non_sensitive/declaracion/1.0.0.pdf" target="_blank">here</a>.
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X GET 'https://api.verifacti.com/verifactu/declaracion' \
              -H 'Authorization: Bearer <API_KEY>'
        - lang: Python
          label: Python
          source: |-
            import requests
            import json

            url = "https://api.verifacti.com/verifactu/declaracion"

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

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

            print(response.status_code)
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |-
            const response = await fetch("https://api.verifacti.com/verifactu/declaracion", {
              headers: {
                "Authorization": "Bearer <API_KEY>"
              }
            });

            const data = await response.json();
            console.log(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const axios = require("axios");

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

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

            $url = "https://api.verifacti.com/verifactu/declaracion";

            $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/verifactu/declaracion\", 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/verifactu/declaracion"))
                        .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.Text;
            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/verifactu/declaracion");

                    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/verifactu/declaracion"

            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: Responsible declaration
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    description: URL where the responsible declaration corresponding to the current software version is hosted.
                    example: https://storage.googleapis.com/verifacti_non_sensitive/declaracion/1.0.0.pdf
                  sistema_informatico:
                    type: object
                    properties:
                      nombre:
                        type: string
                        description: Name of the IT system.
                        example: bilbabit
                      id:
                        type: string
                        description: IT system identifier.
                        example: A1
                      version:
                        type: string
                        description: IT system version.
                        example: 1.0.0
components:
  schemas:
    estadoFactura:
      type: object
      properties:
        uuid:
          description: Unique identifier of the last accepted record for this invoice.
          type: string
          example: b018ced3-b362-4494-8776-9eefff1c160c
        nif_emisor:
          description: NIF of the invoice issuer.
          type: string
          example: A15022510
        num_serie:
          description: Invoice series and number.
          type: string
          example: A34547
        fecha_expedicion:
          description: Invoice issue date.
          type: string
          example: CURRENT_DATE
        subsanacion:
          description: Indicates whether the invoice has been amended (S) or not (N).
          enum:
            - 'N'
            - S
          type: string
          example: 'N'
        rechazo_previo:
          type: string
          enum:
            - 'N'
            - S
            - X
          example: 'N'
          description: |
            This field indicates whether the invoice to be amended was previously rejected by the AEAT.
        tipo_factura:
          type: string
          example: F1
          description: |
            The different invoice types are:
            <ol style="list-style: disc;">
              <li>F1: Invoice (Art. 6, 7.2 and 7.3 of RD 1619/2012)</li>
              <li>F2: Simplified invoice and invoices without recipient identification (Art. 6.1.D RD 1619/2012)</li>
              <li>R1: Corrective invoice (Art. 80.1 and 80.2 and error based on law)</li>
              <li>R2: Corrective invoice (Art. 80.3)</li>
              <li>R3: Corrective invoice (Art. 80.4)</li>
              <li>R4: Corrective invoice (Other)</li>
              <li>R5: Corrective invoice for simplified invoices (Art. 80.3)</li>
              <li>F3: Invoice issued as replacement for billed and declared simplified invoices</li>
            </ol>
        descripcion:
          type: string
          description: Operation description.
          example: Operation description
        lineas:
          type: array
          description: Invoice lines.
          items:
            type: object
            properties:
              base_imponible:
                type: string
                description: Taxable base of the line.
                example: 200
              tipo_impositivo:
                type: string
                description: |
                  Tax rate of the line. If `impuesto` = 01 (VAT) then the allowed values are: 0, 2, 4, 5, 7.5, 10, 21.
                example: '21'
              cuota_repercutida:
                type: string
                description: Output tax of the line.
                example: '42'
              impuesto:
                type: string
                default: '01'
                enum:
                  - '01'
                  - '02'
                  - '03'
                  - '05'
                description: |
                  Tax type.
                    - 01: Value Added Tax (IVA/VAT)
                    - 02: Tax on Production, Services, and Imports (IPSI) of Ceuta and Melilla
                    - 03: Canary Islands General Indirect Tax (IGIC)
                    - 05: Other
                example: '01'
              calificacion_operacion:
                type: string
                enum:
                  - S1
                  - S2
                  - N1
                  - N2
                description: |
                  Operation classification. Can only be specified if the `operacion_exenta` field is not filled in. In that case, the default value `S1` will be used. 
                    - S1: Subject and non-exempt operation - without reverse charge.
                    - S2: Subject and non-exempt operation - with reverse charge.
                    - N1: Non-subject operation (art. 7, 14, other).
                    - N2: Non-subject operation due to location rules.
              clave_regimen:
                type: string
                enum:
                  - '01'
                  - '02'
                  - '03'
                  - '04'
                  - '05'
                  - '06'
                  - '07'
                  - '08'
                  - '09'
                  - '10'
                  - '11'
                  - '14'
                  - '15'
                  - '17'
                  - '18'
                  - '19'
                  - '20'
                description: Key that identifies the VAT/IGIC regime type.
              operacion_exenta:
                type: string
                enum:
                  - E1
                  - E2
                  - E3
                  - E4
                  - E5
                  - E6
                description: Exempt operation type.
              base_imponible_a_coste:
                type: string
                description: Taxable base at cost of the line.
              tipo_recargo_equivalencia:
                type: string
                description: Equivalence surcharge rate of the line.
              cuota_recargo_equivalencia:
                type: string
                description: Equivalence surcharge tax of the line.
        importe_total:
          description: Total invoice amount.
          type: string
          example: '242.00'
        cuota_total:
          description: Total tax of the invoice.
          type: string
          example: '42.00'
        encadenamiento:
          type: object
          description: Data about the previous invoicing record with which this record has been chained.
          properties:
            nif_emisor:
              type: string
              example: B75777847
              description: NIF of the issuer of the previous invoicing record.
            num_serie:
              type: string
              example: A34543
              description: Series and number of the previous invoicing record.
            fecha_expedicion:
              type: string
              example: 01-12-2024
              description: Issue date of the previous invoicing record.
            huella:
              type: string
              example: 058EE12D8FB181EE51901736CA561F8E084857D976560C421D9F6668251645F3
              description: Fingerprint of the previous invoicing record.
        huella:
          description: Invoice fingerprint.
          type: string
          example: F7811516E953893596430BFBC48DD2F790E55DA098E410A430C79EF945E1EAF5
        ultima_modificacion:
          description: Date and time of the last modification.
          type: string
          example: '2024-12-31T11:30:57+01:00'
        estado:
          description: |
            Invoice status in the AEAT system.
            <ol style="list-style: disc;">
              <li>Correcta: invoice registered correctly.</li>
              <li>AceptadaConErrores: invoice accepted by the AEAT that contains errors. Must be amended by issuing a new corrective invoice or using the POST <code>/modify</code> endpoint depending on the case.</li>
              <li>Anulada: invoice cancelled correctly.</li>
            </ol>
              
          type: string
          example: Correcta
    lineas:
      type: object
      example:
        base_imponible: '200.00'
        tipo_impositivo: '21'
        cuota_repercutida: '42.00'
      required:
        - base_imponible
      properties:
        base_imponible:
          type: string
          pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
          description: Taxable base or non-subject amount of the line.
        tipo_impositivo:
          type: string
          pattern: \d{1,3}(\.\d{0,2})?
          description: |
            Tax rate of the line. Required if `calificacion_operacion` is S1 and `base_imponible_a_coste` is not filled in.
            If `impuesto` = 01 (VAT) then the allowed values are: 0, 2, 4, 5, 7.5, 10, 21.
        cuota_repercutida:
          type: string
          pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
          description: Output tax of the line. Can only be non-zero (positive or negative) if `calificacion_operacion` is S1.
        impuesto:
          type: string
          default: '01'
          enum:
            - '01'
            - '02'
            - '03'
            - '05'
          description: |
            Tax type. The allowed values are:
            <ul style="list-style: disc;">
              <li>01: Value Added Tax (IVA/VAT)</li>
              <li>02: Tax on Production, Services, and Imports (IPSI) of Ceuta and Melilla</li>
              <li>03: Canary Islands General Indirect Tax (IGIC)</li>
              <li>05: Other</li>
            </ul>
        calificacion_operacion:
          type: string
          enum:
            - S1
            - S2
            - N1
            - N2
          description: |
            Operation classification. Can only be specified if the `operacion_exenta` field is not filled in. In that case, the default value `S1` will be used. 
            <ul style="list-style: disc;">
              <li>S1: Subject and non-exempt operation - without reverse charge.</li>
              <li>S2: Subject and non-exempt operation - with reverse charge.</li>
              <li>N1: Non-subject operation (art. 7, 14, other).</li>
              <li>N2: Non-subject operation due to location rules.</li>
            </ul>
        clave_regimen:
          type: string
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '14'
            - '15'
            - '17'
            - '18'
            - '19'
            - '20'
          description: |
            Key that identifies the VAT/IGIC regime type. Allowed only when `impuesto` = 01 (VAT) or `impuesto` = 03 (IGIC).
            In these cases the default value is 01.

            <ul style="list-style: disc;">
              <li>01: General regime operation.</li>
              <li>02: Export.</li>
              <li>03: Operations subject to the special regime for second-hand goods, works of art, antiques, and collectible items.</li>
              <li>04: Special regime for investment gold.</li>
              <li>05: Special regime for travel agencies.</li>
              <li>06: Special regime for group of entities in VAT or IGIC (Advanced Level)</li>
              <li>07: Special cash-basis regime.</li>
              <li>08: Operations subject to IPSI/VAT or IGIC.</li>
              <li>09: Invoicing of travel agency services acting as intermediaries on behalf of third parties (D.A.4ª RD1619/2012)</li>
              <li>10: Collections on behalf of third parties for professional fees or rights derived from industrial property, copyright, or others on behalf of their partners, associates, or members by companies, associations, professional bodies, or other entities that perform these collection functions.</li>
              <li>11: Business premises leasing operations.</li>
              <li>14: Invoice with VAT or IGIC pending accrual in work certifications whose recipient is a Public Administration.</li>
              <li>15: Invoice with VAT or IGIC pending accrual in successive tract operations.</li>
              <li>17: Operation under one of the regimes provided in Chapter XI of Title IX (OSS and IOSS) or special retail merchant regime</li>
              <li>18: Equivalence surcharge or special regime for small businesses or professionals.</li>
              <li>19: Operations from activities included in the Special Regime for Agriculture, Livestock, and Fishing (REAGYP) or domestic operations exempt under article 25 of Law 19/1994</li>
              <li>20: Simplified regime</li>
            </ul>
        operacion_exenta:
          type: string
          enum:
            - E1
            - E2
            - E3
            - E4
            - E5
            - E6
          description: |
            Exempt operation type. If filled in, the fields `tipo_impositivo`,
            `cuota_repercutida`, `tipo_recargo_equivalencia`, and `cuota_recargo_equivalencia` cannot be specified. The allowed values are (BOE-A-1992-28740):
            <ul style="list-style: disc;">
              <li>E1: Exempt under article 20</li>
              <li>E2: Exempt under article 21</li>
              <li>E3: Exempt under article 22</li>
              <li>E4: Exempt under article 24</li>
              <li>E5: Exempt under article 25</li>
              <li>E6: Other</li>
            </ul>
        base_imponible_a_coste:
          type: string
          pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
          description: |
            Taxable base at cost of the line. This field can only be filled in if
            `clave_regimen` = 06 or `impuesto` = 02 (IPSI) or `impuesto` = 05 (Other).
        tipo_recargo_equivalencia:
          type: string
          pattern: \d{1,3}(\.\d{0,2})?
          description: |
            Equivalence surcharge rate. See <a href='https://www.agenciatributaria.es/static_files/AEAT_Desarrolladores/EEDD/IVA/VERI-FACTU/Validaciones_Errores_Veri-Factu.pdf' target='_blank'>AEAT documentation</a> for more details.
        cuota_recargo_equivalencia:
          type: string
          pattern: (\+|-)?\d{1,12}(\.\d{0,2})?
          description: |
            Equivalence surcharge tax.
