# CFDI - Listado paginado de peticiones

POST https://fenix-api/cfdi/lazy
Content-Type: application/json

Este endpoint permite consultar de forma paginada las peticiones CFDI registradas en Fénix.

Está diseñado para:

-   
    Obtener listados por bloques de registros  
    
-   
    Aplicar ordenamiento  
    
-   
    Filtrar resultados por datos clave de la petición  
    

Es útil para integraciones que necesiten consultar el estado de CFDIs, identificar facturas generadas y consultar la información fiscal asociada a cada petición.

---

## Parámetros de consulta (Query Params)

Estos parámetros son opcionales y se envían por URL.

| Parámetro | Tipo | Requerido | Descripción |
| --- | --- | --- | --- |
| `orderNo` | string | No | Filtra por un número de orden específico. |
| `status` | string | No | Filtra por el estado actual de la petición. |
| `customerRfc` | string | No | Filtra las peticiones por RFC del cliente receptor. |

---

## Body de ejemplo

``` json
{
    "lazyState": {
        "first": 0,
        "page": 0,
        "rows": 10,
        "sortField": null,
        "sortOrder": "asc"
    }
}

 ```

---

## Descripción del body

### Objeto raíz

| Campo | Tipo | Requerido | Descripción |
| --- | --- | --- | --- |
| `lazyState` | object | Sí | Contiene la configuración de paginación y ordenamiento de la consulta. |

### Objeto `lazyState`

| Campo | Tipo | Requerido | Descripción |
| --- | --- | --- | --- |
| `first` | integer | Sí | Índice del primer registro a recuperar. |
| `page` | integer | Sí | Número de página actual. Generalmente inicia en `0`. |
| `rows` | integer | Sí | Número de registros por página. |
| `sortField` | string / null | No | Campo por el cual se ordenarán los resultados. |
| `sortOrder` | string | Sí | Dirección del ordenamiento. Valores esperados: `asc` o `desc`. |

---

## Descripción del response

### Objeto raíz

| Campo | Tipo | Descripción |
| --- | --- | --- |
| `total_records` | integer | Número total de registros que coinciden con la búsqueda. |
| `records` | array | Lista de peticiones CFDI recuperadas en la página actual. |

---

## Detalle de cada registro en `records`

La estructura es la misma que en `/precfdi/lazy`, con los mismos datos generales de la petición, cliente, seller, detalle de línea, metadata y último log.  
  
La diferencia es que este endpoint agrega información del CFDI generado.

### Campos adicionales

| Campo | Tipo | Descripción |
| --- | --- | --- |
| `previousUuid` | string / null | UUID relacionado previamente con la petición, cuando aplique. |
| `cfdi` | object | Información principal del CFDI generado. |

### Objeto `cfdi`

| Campo | Tipo | Descripción |
| --- | --- | --- |
| `uuid` | string | UUID fiscal del CFDI. |
| `serie` | string | Serie del comprobante. |
| `folio` | string | Folio del comprobante. |
| `stampedDate` | string (ISO 8601) | Fecha y hora de timbrado del CFDI. |

Reference: https://doc.ediwebalterno.com/fenix-sellers/cfdi-listado-paginado-de-peticiones

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /cfdi/lazy:
    post:
      operationId: cfdi-listado-paginado-de-peticiones
      summary: CFDI - Listado paginado de peticiones
      description: >-
        Este endpoint permite consultar de forma paginada las peticiones CFDI
        registradas en Fénix.


        Está diseñado para:


        -   
            Obtener listados por bloques de registros  
            
        -   
            Aplicar ordenamiento  
            
        -   
            Filtrar resultados por datos clave de la petición  
            

        Es útil para integraciones que necesiten consultar el estado de CFDIs,
        identificar facturas generadas y consultar la información fiscal
        asociada a cada petición.


        ---


        ## Parámetros de consulta (Query Params)


        Estos parámetros son opcionales y se envían por URL.


        | Parámetro | Tipo | Requerido | Descripción |

        | --- | --- | --- | --- |

        | `orderNo` | string | No | Filtra por un número de orden específico. |

        | `status` | string | No | Filtra por el estado actual de la petición. |

        | `customerRfc` | string | No | Filtra las peticiones por RFC del
        cliente receptor. |


        ---


        ## Body de ejemplo


        ``` json

        {
            "lazyState": {
                "first": 0,
                "page": 0,
                "rows": 10,
                "sortField": null,
                "sortOrder": "asc"
            }
        }

         ```

        ---


        ## Descripción del body


        ### Objeto raíz


        | Campo | Tipo | Requerido | Descripción |

        | --- | --- | --- | --- |

        | `lazyState` | object | Sí | Contiene la configuración de paginación y
        ordenamiento de la consulta. |


        ### Objeto `lazyState`


        | Campo | Tipo | Requerido | Descripción |

        | --- | --- | --- | --- |

        | `first` | integer | Sí | Índice del primer registro a recuperar. |

        | `page` | integer | Sí | Número de página actual. Generalmente inicia
        en `0`. |

        | `rows` | integer | Sí | Número de registros por página. |

        | `sortField` | string / null | No | Campo por el cual se ordenarán los
        resultados. |

        | `sortOrder` | string | Sí | Dirección del ordenamiento. Valores
        esperados: `asc` o `desc`. |


        ---


        ## Descripción del response


        ### Objeto raíz


        | Campo | Tipo | Descripción |

        | --- | --- | --- |

        | `total_records` | integer | Número total de registros que coinciden
        con la búsqueda. |

        | `records` | array | Lista de peticiones CFDI recuperadas en la página
        actual. |


        ---


        ## Detalle de cada registro en `records`


        La estructura es la misma que en `/precfdi/lazy`, con los mismos datos
        generales de la petición, cliente, seller, detalle de línea, metadata y
        último log.  
          
        La diferencia es que este endpoint agrega información del CFDI generado.


        ### Campos adicionales


        | Campo | Tipo | Descripción |

        | --- | --- | --- |

        | `previousUuid` | string / null | UUID relacionado previamente con la
        petición, cuando aplique. |

        | `cfdi` | object | Información principal del CFDI generado. |


        ### Objeto `cfdi`


        | Campo | Tipo | Descripción |

        | --- | --- | --- |

        | `uuid` | string | UUID fiscal del CFDI. |

        | `serie` | string | Serie del comprobante. |

        | `folio` | string | Folio del comprobante. |

        | `stampedDate` | string (ISO 8601) | Fecha y hora de timbrado del CFDI.
        |
      tags:
        - ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CFDI - Listado paginado de
                  peticiones_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostCfdiLazyRequestBadRequestError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                lazyState:
                  $ref: >-
                    #/components/schemas/CfdiLazyPostRequestBodyContentApplicationJsonSchemaLazyState
              required:
                - lazyState
servers:
  - url: https://fenix-api
  - url: https://precfdi
  - url: https://cfdi
components:
  schemas:
    CfdiLazyPostRequestBodyContentApplicationJsonSchemaLazyState:
      type: object
      properties:
        first:
          type: integer
        page:
          type: integer
        rows:
          type: integer
        sortField:
          description: Any type
        sortOrder:
          type: string
      required:
        - first
        - page
        - rows
        - sortOrder
      title: CfdiLazyPostRequestBodyContentApplicationJsonSchemaLazyState
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCfdi:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        serie:
          type: string
        folio:
          type: string
        stampedDate:
          type: string
          format: date-time
      required:
        - uuid
        - serie
        - folio
        - stampedDate
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCfdi
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayloadPaymentMethods:
      type: object
      properties:
        paymentType:
          type: string
      required:
        - paymentType
      title: >-
        CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayloadPaymentMethods
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayload:
      type: object
      properties:
        usoCDFI:
          type: string
        paymentMethods:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayloadPaymentMethods
      required:
        - usoCDFI
        - paymentMethods
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayload
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomerAddress:
      type: object
      properties:
        addressType:
          type: string
        addressLineOne:
          type: string
        addressLineTwo:
          type: string
        locality:
          type: string
        subLocality:
          type: string
        city:
          type: string
        state:
          type: string
        countryCode:
          type: string
        zipCode:
          type: string
        stateCode:
          type: string
        localityCode:
          type: string
        municipalityCode:
          type: string
      required:
        - addressType
        - addressLineOne
        - addressLineTwo
        - locality
        - subLocality
        - city
        - state
        - countryCode
        - zipCode
        - stateCode
        - localityCode
        - municipalityCode
      title: >-
        CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomerAddress
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomer:
      type: object
      properties:
        rfc:
          type: string
        name:
          type: string
        regimenFiscalReceptor:
          type: string
        address:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomerAddress
      required:
        - rfc
        - name
        - regimenFiscalReceptor
        - address
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomer
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsSeller:
      type: object
      properties:
        name:
          type: string
        rfc:
          type: string
        zipCode:
          type: string
      required:
        - name
        - rfc
        - zipCode
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsSeller
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailItem:
      type: object
      properties:
        description:
          type: string
        taxProductCode:
          type: string
        upc:
          type: string
      required:
        - description
        - taxProductCode
        - upc
      title: >-
        CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailItem
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailLineTotals:
      type: object
      properties:
        subTotal:
          type: number
          format: double
        discountTotal:
          type: integer
        shippingTotal:
          type: integer
        taxTotal:
          type: number
          format: double
        total:
          type: number
          format: double
      required:
        - subTotal
        - discountTotal
        - shippingTotal
        - taxTotal
        - total
      title: >-
        CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailLineTotals
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetail:
      type: object
      properties:
        primeLineNo:
          type: string
        unitOfMeasure:
          type: string
        quantity:
          type: integer
        unitPrice:
          type: number
          format: double
        objetoImp:
          type: string
        item:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailItem
        lineTotals:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetailLineTotals
      required:
        - primeLineNo
        - unitOfMeasure
        - quantity
        - unitPrice
        - objetoImp
        - item
        - lineTotals
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetail
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsMetadata:
      type: object
      properties:
        status:
          type: string
        creationDate:
          type: string
          format: date-time
      required:
        - status
        - creationDate
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsMetadata
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLastLog:
      type: object
      properties:
        title:
          type: string
        message:
          type: string
        level:
          type: string
        date:
          type: string
          format: date-time
      required:
        - title
        - message
        - level
        - date
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLastLog
    CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItems:
      type: object
      properties:
        id:
          type: string
        previousUuid:
          description: Any type
        cfdi:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCfdi
        reqTransactionId:
          type: string
        reqTransactionLineId:
          type: string
        purpose:
          type: string
        dateInvoiced:
          type: string
          format: date-time
        invoiceId:
          type: string
        orderNo:
          type: string
        sellerId:
          type: string
        autoMotor:
          type: boolean
        payload:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsPayload
        customer:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsCustomer
        seller:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsSeller
        lineDetail:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLineDetail
        metadata:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsMetadata
        lastLog:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItemsLastLog
      required:
        - id
        - cfdi
        - reqTransactionId
        - reqTransactionLineId
        - purpose
        - dateInvoiced
        - invoiceId
        - orderNo
        - sellerId
        - autoMotor
        - payload
        - customer
        - seller
        - lineDetail
        - metadata
        - lastLog
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItems
    CFDI - Listado paginado de peticiones_Response_200:
      type: object
      properties:
        total_records:
          type: integer
        records:
          type: array
          items:
            $ref: >-
              #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaRecordsItems
      required:
        - total_records
        - records
      title: CFDI - Listado paginado de peticiones_Response_200
    CfdiLazyPostResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        details:
          type: string
        message:
          type: string
      required:
        - details
        - message
      title: CfdiLazyPostResponsesContentApplicationJsonSchemaError
    PostCfdiLazyRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/CfdiLazyPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostCfdiLazyRequestBadRequestError

```

## SDK Code Examples

```python CFDI - Listado paginado de peticiones_example
import requests

url = "https://fenix-api/cfdi/lazy"

payload = { "lazyState": {
        "first": 0,
        "page": 0,
        "rows": 10,
        "sortOrder": "asc"
    } }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript CFDI - Listado paginado de peticiones_example
const url = 'https://fenix-api/cfdi/lazy';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"lazyState":{"first":0,"page":0,"rows":10,"sortOrder":"asc"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go CFDI - Listado paginado de peticiones_example
package main

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

func main() {

	url := "https://fenix-api/cfdi/lazy"

	payload := strings.NewReader("{\n  \"lazyState\": {\n    \"first\": 0,\n    \"page\": 0,\n    \"rows\": 10,\n    \"sortOrder\": \"asc\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby CFDI - Listado paginado de peticiones_example
require 'uri'
require 'net/http'

url = URI("https://fenix-api/cfdi/lazy")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lazyState\": {\n    \"first\": 0,\n    \"page\": 0,\n    \"rows\": 10,\n    \"sortOrder\": \"asc\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java CFDI - Listado paginado de peticiones_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://fenix-api/cfdi/lazy")
  .header("Content-Type", "application/json")
  .body("{\n  \"lazyState\": {\n    \"first\": 0,\n    \"page\": 0,\n    \"rows\": 10,\n    \"sortOrder\": \"asc\"\n  }\n}")
  .asString();
```

```php CFDI - Listado paginado de peticiones_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://fenix-api/cfdi/lazy', [
  'body' => '{
  "lazyState": {
    "first": 0,
    "page": 0,
    "rows": 10,
    "sortOrder": "asc"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp CFDI - Listado paginado de peticiones_example
using RestSharp;

var client = new RestClient("https://fenix-api/cfdi/lazy");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lazyState\": {\n    \"first\": 0,\n    \"page\": 0,\n    \"rows\": 10,\n    \"sortOrder\": \"asc\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CFDI - Listado paginado de peticiones_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["lazyState": [
    "first": 0,
    "page": 0,
    "rows": 10,
    "sortOrder": "asc"
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://fenix-api/cfdi/lazy")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```