Syntage Extractions API

Extractions are tasks that retrieve data for an entity from a datasource. They are used to collect invoices, tax returns, tax status, tax compliance checks, RPC records, RUG guarantees, Buró de Crédito reports, BIL reports, and other datasource-backed records. An extraction runs asynchronously. Creating one starts or queues the work, and the returned Extraction resource tracks its status, options, timing, errors, and the number of resources created or updated. ## How Extractions Work 1. Create or retrieve the entity you want to extract data for. 2. Create an extraction with the entity IRI, extractor name, and extractor options. 3. Store the returned extraction ID. 4. Retrieve the extraction until its `status` is `finished` or `failed`. 5. Read the extracted data from the related resource endpoints, such as invoices or tax returns. If the same extraction is already pending or running for the same entity, extractor, and options, Syntage returns a duplicate extraction response instead of starting the same work again. ## Options Options containing a period (`.`) in the name like `period.from` are a way to denote object paths. For example, `period.from` should actually be sent as: ```json { "options": { "period": { "from": "2020-01-01", "to": "2020-12-31" } } } ``` Extractor names and options are specific to the data you are extracting. For extraction-backed resources, use the resource overview page for the extractor name, required credentials, supported options, and the endpoint where the extracted records can be read. # Extraction status | Status | Description | | ------ | ----------- | | pending | The initial extraction status. The extraction is enqueued and waiting to be processed. | | waiting | The extraction does not meet the requirements to begin. | | running | The extraction process started and is currently running. The running time varies depending on the extractor type and the entity's transactional volume. You may find partial data available in our API endpoints during this time. | | finished | The extraction finished successfully. All data is available to be retrieved from our API endpoints. | | failed | The extraction couldn't start or failed during the process. Our internal retry policies weren't able to finish the extraction successfully. We may have partial data available in our API endpoints, but new extractions should be created to ensure all the entity's data is available. You can check the [extraction error code](#section/Extraction-error-codes) to understand why it failed and determine whether it can be retried or not. | | stopping | The extraction was requested to be stopped by the user. It is in the process of being stopped. | | stopped | The extraction was stopped by the user after it started running. This extraction is included in billing. | | cancelled | The extraction was stopped by the user before it started running. This extraction is not included in billing. | # Extraction error codes | Code | Description | Retryable | | ---- | ----------- | --------- | | invalid_credentials | The SAT [Credential](#tag/Credentials) is no longer valid. | No | | login_failed | We couldn't log in with the SAT credential. | Yes | | unrecoverable | The extraction process failed many times, and we reached a maximum number of retries. | Yes | | sat_unavailable | We detected that SAT itself is down or unresponsive. | Yes | | internal_error | We detected an internal error in our own infrastructure. | Yes | | undefined | We couldn't determine the error cause and our internal team will investigate it. | Yes |

OpenAPI Specification

syntage-extractions-api-openapi.yml Raw ↑
openapi: 3.0.2
info:
  version: '2020-06-28'
  title: Syntage Accounts Payable Insight Extractions API
  contact:
    name: Email
    email: support@syntage.com
  description: "# Introduction\n\nThe Syntage API is organized around [REST](https://en.wikipedia.org/wiki/Representational_State_Transfer).\nOur API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns [JSON-LD](https://json-ld.org) responses, and uses standard HTTP response codes, authentication, and verbs.\n\n# Environments\n\n| Name | Description | Base URL |\n|------|-------------|----------|\n| **Sandbox** | The Sandbox environment is dedicated to development and testing. In this environment, no real taxpayer credentials are required and all interaction with the SAT is simulated generating life-like data, allowing you to pull test data from all endpoints. | https://api.sandbox.syntage.com |\n| **Production** | The Production environment is dedicated to live applications with real connections to the SAT. In this environment, real taxpayer credentials are required, and you will pull real fiscal data directly from the SAT. | https://api.syntage.com |\n\nEach environment has a different API Key for [authentication](#section/Authentication).\n\n# Request IDs\n\nEach API request has an associated request identifier.\nYou can find this value in the response headers, under `X-Request-ID`:\n\n```curl\ncurl -i https://api.syntage.com\nHTTP/1.1 200 OK\nDate: Sun, 29 Nov 2020 19:21:21 GMT\nX-Request-ID: Root=1-6532dcae-169bf139354cd48959f55c55\n```\n\nIf you need to contact us about a specific request, providing the request identifier will ensure the fastest possible resolution.\n\n# Rate Limiting\n\nOur API employs a number of safeguards against bursts of incoming traffic to help maximize its stability.\nThe returned HTTP headers of any API request show your current rate limit status:\n\n```curl\ncurl -i https://api.syntage.com\nHTTP/1.1 200 OK\nDate: Sun, 29 Nov 2020 19:21:21 GMT\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1606678044\n```\n\n| Header Name           | Description |\n|-----------------------|------------------------------------------------------------------------------|\n| X-RateLimit-Limit     | The maximum number of requests you're permitted to make.                     |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window.           |\n| X-RateLimit-Reset     | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nIf you exceed the rate limit, a [429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) response is returned:\n\n```http\nHTTP/1.1 429 Too Many Requests\nDate: Sun, 29 Nov 2020 19:21:21 GMT\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 0\nX-RateLimit-Reset: 1606678044\n```\n\nWe may reduce limits to prevent abuse, or increase limits to enable high-traffic operations.\nYou can check your current limits in the [dashboard](https://app.syntage.com/settings/usage).\nTo request an increased rate limit, please [contact support](https://support.syntage.com/).\n# Pagination\nWhen issuing a GET request on a collection containing more than 1 page (e.g. [/events](#operation/ListEvent)),  a collection is returned. Links to the first, the last, previous and the next page in the collection are displayed as well as the  number of total items in the collection.\nAll endpoints that support this operation have a query parameter defined by:\n  - `itemsPerPage` The number of items per page (default: 20, max: 1000)\n  - `page` The collection page number\n\n```bash\n  \"hydra:totalItems\": 1,\n  \"hydra:view\": {\n    \"@id\": \"/events?page=1\",\n    \"@type\": \"hydra:PartialCollectionView\",\n    \"hydra:first\": \"/events?page=1\",\n    \"hydra:next\": \"/events?page=2\",\n    \"hydra:last\": \"/events?page=3\"\n  },\n```\n## Cursor Pagination\nCursor pagination is a technique used for navigating through large datasets efficiently. It allows you to retrieve a specific subset of results from a collection by using a cursor value that represents the position within the collection. The cursor serves as a reference point for fetching the next or previous set of results.\n### Benefits of Cursor Pagination:\n1. **Efficient Navigation:** Cursor pagination eliminates the need to fetch the entire dataset at once, making it more scalable and faster. You can retrieve data in smaller, manageable chunks based on the cursor values.\n2. **Consistent Results:** Each page of results in cursor pagination is stable and doesn't change even if new items are added or removed from the collection. This ensures that you get consistent and reliable results.\n3. **Flexibility:** Cursors can be used to navigate forwards and backwards in the collection without impacting performance.\n\n### How to Use Cursor Pagination:\nTo use cursor pagination with our API, follow these instructions:\n1. Make a request to retrieve the initial page of results. The response will be a JSON-LD document that includes a `hydra:next` attribute with the URI for the next page. The URI already includes the cursor attribute.\n2. To retrieve the next page of results, make a GET request to the URI provided in the `hydra:next` attribute. This URI will automatically include the cursor value for the next page.\n3. If you want to navigate to the previous page, you can use the `hydra:previous` attribute in the JSON-LD response. It will contain the URI for the previous page, including the cursor value.\n4. You can continue making requests to the `hydra:next` and `hydra:previous` URIs to navigate through the paginated results, based on your requirements.\nMake sure to update your request headers to include the necessary headers for JSON-LD content negotiation, such as `Accept: application/ld+json` or `Content-Type: application/ld+json`.\nBy following these instructions, you can effectively navigate through the paginated results using the cursor values provided in the `hydra:next` and `hydra:previous` attributes, without the need to manually include the cursor in your requests. This simplifies the pagination process and enhances the usability of our API.\n\n### Considerations About Cursor Pagination:\n\n  - By default, the API uses offset-based pagination (except for a few endpoints that we will list below). If you want to switch to cursor pagination, you need to include an additional header in your request. Set the `X-Pagination-Style` header with the value `\"cursor\"` to enable cursor pagination. If not specified, the API will assume offset-based pagination.\n\n  - After enabling cursor pagination, the API response will no longer include the `hydra:totalItems` field by default. Retrieving the total count can be resource intensive and impact response times, especially for large datasets. However, if you need the `hydra:totalItems` information, you can include an additional header in your request. Set the `X-Pagination-Enable-Partial` header with the value `0` to indicate that the response should include extra information, including the `hydra:totalItems` count. Please be aware that enabling this feature may impact API response times, as the backend needs to perform a count operation on the dataset.\n\nIf you require the `hydra:totalItems` count, please consider the potential impact on API response times.\n### Example\n```bash\n  curl -i 'https://api.syntage.com/entities/{entityId}/invoices?itemsPerPage=10' \\\n    --header 'Accept: application/ld+json' \\\n    --header 'X-Api-Key: {apiKey}' \\\n    --header 'X-Pagination-Style: cursor' \\\n    --header 'X-Pagination-Enable-Partial: 0'\n```\n**Note:** We only support cursor pagination for the following endpoints:\n - `GET /entities/{entityId}/invoices`\n - `GET /entities/{entityId}/invoices/line-items`\n - `GET /entities/{entityId}/invoices/{invoiceId}/line-items`\n - `GET /invoices/{invoiceId}/line-items`\n - `GET /entities/{entityId}/invoices/payments`\n\nFeel free to reach out if you have any further questions or need additional assistance!\n\n# Property Filtering\nThe property filter adds the possibility to select the properties for GET operations.\nSyntax: `?properties[]=<property>&properties[<relation>][]=<property>`\nYou can add as many properties as you need. The following example shows how to select `paymentType` and  `issuer.rfc` when fetching a list of invoices.\n```curl\n  curl -i https://api.syntage.com/entities/{entityId}/invoices?properties[]=paymentType&properties[issuer]=rfc\n```\n# Filtering\n**Warning:** Collection endpoints only apply the filter query parameters documented for that endpoint. If you send an unsupported or misspelled filter query parameter, the API ignores it and processes the request as if that parameter was not sent.\n\n# API Versioning Guide\nGuidance on changes between versions.\n## Version: 2020-01-01 to 2020-06-28\n### **Invoice**\n_**Affected Endpoints:** `GET /invoices/{id}` and `GET /entities/{entityId}/invoices`_\n- The `amount` property has been removed from API responses. Use the `total` property instead.\n- Retrieval by invoice's `uuid` at `/invoices/{id}` is now removed. To retrieve an invoice, use the invoice's `id` at the specified endpoint. To find an invoice using its `uuid`, filter the invoice collection at `/entities/{entityId}/invoices?uuid[]={uuid}`.\n- Previously, the `@iri` property for an invoice pointed to the resource using `uuid`, like `/invoices/{uuid}`. Now, it points using its `id`, like `/invoices/{id}`.\n\n### **Entity (Formerly Link)**\n_**Affected Endpoint:** `GET /entities`_\n- Filtering entities by `status` is removed. Use `credential.status` instead. For example, utilize `GET /entities?credential.status[]=active` instead of `GET /entities?status[]=active`.\n\n### **Tax Return**\n_**Affected Endpoints:** `GET /tax-returns/{id}` and `GET /entities/{entityId}/tax-returns`_\n- Retrieval by tax return's `operationNumber` at `/tax-returns/{id}` is removed. To retrieve a tax return, use the tax return's `id` at the mentioned endpoint. To find a tax return using its `operationNumber`, filter the collection at `/entities/{entityId}/tax-returns?operationNumber[]={operationNumber}`.\n- Previously, the `@iri` property for a tax return pointed to the resource using `operationNumber`, like `/tax-returns/{operationNumber}`. Now, it directs to its `id`, like `/tax-returns/{id}`.\n\n### **Event**\n_**Affected Endpoints:** `GET /events` and `GET /events/{id}`_\n- For events associated to an `tax-return`, the `@iri` property now directs to `/tax-returns/{id}` instead of the previous `/tax-returns/{operationNumber}`.\n- For events associated to an `invoice`, the `@iri` property now directs to `/invoices/{id}` instead of the previous `/invoices/{uuid}`.\n\n### **Extraction**\n_**Affected Endpoints:** `GET /extractions` and `GET /extractions/{id}`_\n- The `periodFrom` property has been removed. Use `options.period.from` instead.\n- The `periodTo` property has been removed. Use `options.period.to` instead.\n\n### **File**\n_**Affected Endpoint:** `GET /file/{id}`_\n- For files associated to an `tax-return`, the `@iri` property now directs to `/tax-returns/{id}`, instead of the previous `/tax-returns/{operationNumber}`.\n- For files associated to an `invoice`, the `@iri` property now directs to `/invoices/{id}`, instead of the previous `/invoices/{uuid}`.\n\n### Trying Out This Version\nIf you want to test this version, you can do so by making any request with the `Accept-Version` header pointing to the latest version:\n```curl\n  curl -i 'https://api.syntage.com/entities/{entityId}/invoices' \\\n    --header 'Accept-Version: 2020-06-28' \\\n    --header 'X-Api-Key: {apiKey}'\n```\n"
servers:
- url: https://api.syntage.com
  description: Production
- url: https://api.sandbox.syntage.com
  description: Sandbox
security:
- ApiKey: []
tags:
- name: Extractions
  description: "Extractions are tasks that retrieve data for an entity from a datasource. They are used to collect invoices, tax returns, tax status, tax compliance checks, RPC records, RUG guarantees, Buró de Crédito reports, BIL reports, and other datasource-backed records.\n\nAn extraction runs asynchronously. Creating one starts or queues the work, and the returned Extraction resource tracks its status, options, timing, errors, and the number of resources created or updated.\n\n## How Extractions Work\n\n1. Create or retrieve the entity you want to extract data for.\n2. Create an extraction with the entity IRI, extractor name, and extractor options.\n3. Store the returned extraction ID.\n4. Retrieve the extraction until its `status` is `finished` or `failed`.\n5. Read the extracted data from the related resource endpoints, such as invoices or tax returns.\n\nIf the same extraction is already pending or running for the same entity, extractor, and options, Syntage returns a duplicate extraction response instead of starting the same work again.\n\n## Options\n\nOptions containing a period (`.`) in the name like `period.from` are a way to denote object paths. For example, `period.from` should actually be sent as:\n\n```json\n{\n    \"options\": {\n      \"period\": {\n        \"from\": \"2020-01-01\",\n        \"to\": \"2020-12-31\"\n      }\n    }\n}\n```\n\nExtractor names and options are specific to the data you are extracting. For extraction-backed resources, use the resource overview page for the extractor name, required credentials, supported options, and the endpoint where the extracted records can be read.\n\n# Extraction status\n\n| Status | Description |\n| ------ | ----------- |\n| pending | The initial extraction status. The extraction is enqueued and waiting to be processed. |\n| waiting | The extraction does not meet the requirements to begin. |\n| running | The extraction process started and is currently running. The running time varies depending on the extractor type and the entity's transactional volume. You may find partial data available in our API endpoints during this time. |\n| finished | The extraction finished successfully. All data is available to be retrieved from our API endpoints. |\n| failed | The extraction couldn't start or failed during the process. Our internal retry policies weren't able to finish the extraction successfully. We may have partial data available in our API endpoints, but new extractions should be created to ensure all the entity's data is available. You can check the [extraction error code](#section/Extraction-error-codes) to understand why it failed and determine whether it can be retried or not. |\n| stopping | The extraction was requested to be stopped by the user. It is in the process of being stopped. |\n| stopped | The extraction was stopped by the user after it started running. This extraction is included in billing. |\n| cancelled | The extraction was stopped by the user before it started running. This extraction is not included in billing. |\n# Extraction error codes\n\n| Code | Description | Retryable |\n| ---- | ----------- | --------- |\n| invalid_credentials | The SAT [Credential](#tag/Credentials) is no longer valid. | No |\n| login_failed | We couldn't log in with the SAT credential. | Yes |\n| unrecoverable | The extraction process failed many times, and we reached a maximum number of retries. | Yes |\n| sat_unavailable | We detected that SAT itself is down or unresponsive. | Yes |\n| internal_error | We detected an internal error in our own infrastructure. | Yes |\n| undefined | We couldn't determine the error cause and our internal team will investigate it. | Yes |\n"
paths:
  /extractions:
    post:
      tags:
      - Extractions
      operationId: CreateExtraction
      summary: Create an extraction
      description: 'Create an extraction for a specific entity, extractor, and options.


        If an equivalent extraction is already `pending` or `running` for the same entity, extractor, and options, the API returns `409 Conflict` instead of starting a duplicate. Retrieve the in-progress extraction to track its status rather than retrying the request.

        '
      requestBody:
        $ref: '#/components/requestBodies/ExtractionCreate'
      responses:
        '202':
          $ref: '#/components/responses/Extraction'
        '400':
          $ref: '#/components/responses/ConstraintViolation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/DuplicateExtraction'
    get:
      tags:
      - Extractions
      operationId: ListExtraction
      summary: List all extractions
      description: List extraction tasks and filter them by entity, extractor, status, dates, or SAT rate limit state.
      responses:
        '200':
          $ref: '#/components/responses/ExtractionCollection'
        '401':
          $ref: '#/components/responses/Unauthorized'
      parameters:
      - name: taxpayer.id
        in: query
        description: Filter by RFC (Registro Federal de Contribuyentes, exact match)
        schema:
          type: string
          minLength: 12
          maxLength: 13
          example: PEIC211118IS0
      - name: extractor
        in: query
        description: Filter by extractor (partial match)
        example: invoice
        schema:
          $ref: '#/components/schemas/ExtractionExtractor'
      - name: status
        in: query
        description: Filter by status (exact match)
        schema:
          $ref: '#/components/schemas/ExtractionStatus'
      - name: startedAt[before]
        in: query
        description: Filter by start date (less than or equal `<=`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: startedAt[strictly_before]
        in: query
        description: Filter by start date (less than `<`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: startedAt[after]
        in: query
        description: Filter by start date (greater than or equal `>=`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: startedAt[strictly_after]
        in: query
        description: Filter by start date (greater than `>`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: finishedAt[before]
        in: query
        description: Filter by finished date (less than or equal `<=`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: finishedAt[strictly_before]
        in: query
        description: Filter by finished date (less than `<`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: finishedAt[after]
        in: query
        description: Filter by finished date (greater than or equal `>=`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: finishedAt[strictly_after]
        in: query
        description: Filter by finished date (greater than `>`)
        example: '2020-01-17 11:47:27'
        schema:
          type: string
          format: date-time
      - name: exists[rateLimitedAt]
        in: query
        description: Filter extractions that was rate limited by SAT
        example: '1'
        schema:
          type: boolean
          example: true
      - $ref: '#/components/parameters/createdAtBefore'
      - $ref: '#/components/parameters/createdAtStrictlyBefore'
      - $ref: '#/components/parameters/createdAtAfter'
      - $ref: '#/components/parameters/createdAtStrictlyAfter'
      - name: order[startedAt]
        in: query
        description: Order by start date
        schema:
          $ref: '#/components/schemas/CollectionOrder'
      - name: order[finishedAt]
        in: query
        description: Order by finished date
        schema:
          $ref: '#/components/schemas/CollectionOrder'
      - $ref: '#/components/parameters/orderCreatedAt'
      - $ref: '#/components/parameters/orderUpdatedAt'
      - $ref: '#/components/parameters/collectionCursorNextPageParam'
      - $ref: '#/components/parameters/collectionCursorPreviousPageParam'
      - $ref: '#/components/parameters/collectionLimit'
  /extractions/{id}:
    get:
      tags:
      - Extractions
      operationId: GetExtraction
      summary: Retrieve an extraction
      description: Retrieve a single extraction, including its extractor, options, status, timing, error code, and data point counts.
      parameters:
      - $ref: '#/components/parameters/resourceId'
      responses:
        '200':
          $ref: '#/components/responses/Extraction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /extractions/{id}/stop:
    delete:
      tags:
      - Extractions
      operationId: StopExtraction
      summary: Request the extraction to be stopped
      description: Request cancellation for a pending or running extraction.
      parameters:
      - $ref: '#/components/parameters/resourceId'
      responses:
        '204':
          description: Extraction stopping process started
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    ExtractionCollection:
      description: Extraction collection response
      content:
        application/ld+json:
          schema:
            $ref: '#/components/schemas/ExtractionCollection'
    ConstraintViolation:
      description: Validation error
      content:
        application/ld+json:
          schema:
            type: object
            properties:
              '@context':
                type: string
                default: /contexts/ConstraintViolation
              '@type':
                type: string
                default: ConstraintViolation
              hydra:title:
                type: string
                default: An error occurred
              hydra:description:
                type: string
                description: Concatenated violation messages
                example: 'exampleField: This value should not be blank.'
              violations:
                type: array
                items:
                  type: object
                  properties:
                    propertyPath:
                      type: string
                      description: Property access path
                      example: exampleField
                    message:
                      type: string
                      description: Validaton error message
                      example: This value should not be blank.
    Extraction:
      description: Extraction resource response
      content:
        application/ld+json:
          schema:
            allOf:
            - type: object
              properties:
                '@context':
                  type: string
                  default: /contexts/Extraction
            - $ref: '#/components/schemas/Extraction'
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    DuplicateExtraction:
      description: 'One or more requested extractions are already `pending` or `running` for the same entity, extractor, and options.

        The response lists the extractors whose equivalent extraction is already in progress; remove them before retrying the request.

        '
      content:
        application/ld+json:
          schema:
            type: object
            required:
            - conflictingExtractors
            properties:
              conflictingExtractors:
                type: array
                description: Extractors whose equivalent extraction is already in progress.
                minItems: 1
                uniqueItems: true
                items:
                  $ref: '#/components/schemas/ExtractionExtractor'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
  parameters:
    createdAtStrictlyAfter:
      name: createdAt[strictly_after]
      in: query
      description: Filter by resource creation date (greater than `>`)
      example: '2020-01-17 11:47:27'
      schema:
        type: string
        format: date-time
    collectionCursorNextPageParam:
      name: id[lt]
      in: query
      required: false
      example: 91106968-1abd-4d64-85c1-4e73d96fb997
      description: Collection cursor pointer to the next page
      schema:
        type: string
    createdAtStrictlyBefore:
      name: createdAt[strictly_before]
      in: query
      description: Filter by resource creation date (less than `<`)
      example: '2020-01-17 11:47:27'
      schema:
        type: string
        format: date-time
    createdAtBefore:
      name: createdAt[before]
      in: query
      description: Filter by resource creation date (less than or equal `<=`)
      example: '2020-01-17 11:47:27'
      schema:
        type: string
        format: date-time
    collectionLimit:
      name: itemsPerPage
      in: query
      required: false
      description: Number of items per page
      schema:
        $ref: '#/components/schemas/CollectionLimit'
    orderUpdatedAt:
      name: order[updatedAt]
      in: query
      description: Order by resource update date
      schema:
        $ref: '#/components/schemas/CollectionOrder'
    collectionCursorPreviousPageParam:
      name: id[gt]
      in: query
      required: false
      example: 91106968-1abd-4d64-85c1-4e73d96fb997
      description: Collection cursor pointer to the previous page
      schema:
        type: string
    orderCreatedAt:
      name: order[createdAt]
      in: query
      description: Order by resource creation date
      schema:
        $ref: '#/components/schemas/CollectionOrder'
    resourceId:
      name: id
      in: path
      required: true
      example: 91106968-1abd-4d64-85c1-4e73d96fb997
      schema:
        type: string
        format: uuid
    createdAtAfter:
      name: createdAt[after]
      in: query
      description: Filter by resource creation date (greater than or equal `>=`)
      example: '2020-01-17 11:47:27'
      schema:
        type: string
        format: date-time
  schemas:
    TaxpayerID:
      type: string
      minLength: 12
      maxLength: 13
      description: RFC (Registro Federal de Contribuyentes)
      example: PEIC211118IS0
    ExtractionErrorCode:
      type: string
      description: '[Extraction error code](#section/Extraction-error-codes)

        '
      nullable: true
      example: null
      enum:
      - invalid_credentials
      - login_failed
      - unrecoverable
      - sat_unavailable
      - internal_error
      - undefined
    ExtractionRateLimitedAt:
      type: string
      format: date-time
      description: 'This field returns a date when the taxpayer reached the max amount of downloaded CFDI files allowed by SAT in a range of 24hrs. You should retry this extraction 24hrs later. If your taxpayer has not reached the max amount this value should be `NULL`

        '
      example: '2019-01-03T21:10:40.000Z'
    ExtractionUpdatedDataPoints:
      type: integer
      description: 'When your taxpayer has resources by a previous extraction and new extraction found changes between our data and Sat data it would update this resource. For example, when a new extraction finds a Canceled invoice which you previously extracted as an Active invoice.

        '
      example: 2
    Extraction:
      type: object
      properties:
        '@id':
          type: string
          format: iri-reference
          description: Extraction IRI reference
          example: /extractions/91106968-1abd-4d64-85c1-4e73d96fb997
        '@type':
          type: string
          description: JSON-LD resource type
          default: Extraction
        id:
          type: string
          format: uuid
          description: Unique extraction ID
          example: 91106968-1abd-4d64-85c1-4e73d96fb997
        taxpayer:
          $ref: '#/components/schemas/Taxpayer'
        extractor:
          $ref: '#/components/schemas/ExtractionExtractor'
        options:
          $ref: '#/components/schemas/ExtractionOptions'
        status:
          $ref: '#/components/schemas/ExtractionStatus'
        startedAt:
          type: string
          format: date-time
          description: Time when the _status_ changed from **pending** to **running**
          nullable: true
        finishedAt:
          type: string
          format: date-time
          description: Time when the _status_ changed from **running** to **finished** or **failed**
          nullable: true
        rateLimitedAt:
          $ref: '#/components/schemas/ExtractionRateLimitedAt'
        errorCode:
          $ref: '#/components/schemas/ExtractionErrorCode'
        createdDataPoints:
          $ref: '#/components/schemas/ExtractionCreatedDataPoints'
        updatedDataPoints:
          $ref: '#/components/schemas/ExtractionUpdatedDataPoints'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
    TaxpayerPersonType:
      type: string
      enum:
      - physical
      - legal
      example: physical
    ExtractionCollection:
      allOf:
      - $ref: '#/components/schemas/CursorCollection'
      - type: object
        properties:
          '@context':
            default: /contexts/Extraction
          '@id':
            default: /extractions
          hydra:member:
            items:
              $ref: '#/components/schemas/Extraction'
    ExtractionStatus:
      type: string
      enum:
      - pending
      - running
      - finished
      - failed
      - stopping
      - stopped
    updatedAt:
      type: string
      description: Date and time the resource was last updated
      example: '2020-01-01T12:15:00.000Z'
    CollectionLimit:
      type: integer
      default: 20
      minimum: 1
      maximum: 1000
    ExtractionCreatedDataPoints:
      type: integer
      description: 'This is the number of created resources. For example, if 1 invoice was created with its XML and PDF file this value should be 3. And If you previously extracted all the resources and there are no more resources to create this value is 0.

        '
      example: 3
    TaxpayerName:
      type: string
      minLength: 1
      maxLength: 254
      description: Taxpayer name
      example: Pedro Infante Cruz
    createdAt:
      type: string
      description: Date and time the resource was created
      example: '2020-01-01T12:15:00.000Z'
    ExtractionExtractor:
      type: string
      description: Extractor to run, which retrieves resources from the corresponding datasource
      enum:
      - invoice
      - monthly_tax_return
      - annual_tax_return
      - rif_tax_return
      - tax_status
      - tax_retention
      - tax_compliance
      - electronic_accounting
      - sat_certificates
      - rpc
      - buro_de_credito_report
      - bil
      - rug
      - background_check
    Taxpayer:
      type: object
      properties:
        '@id':
          type: string
          format: iri-reference
          description: Taxpayer IRI reference
          example: /taxpayers/PEIC211118IS0
        '@type':
          type: string
          default: Taxpayer
        id:
          $ref: '#/components/schemas/TaxpayerID'
        personType:
          $ref: '#/components/schemas/TaxpayerPersonType'
        registrationDate:
          type: string
          format: date
          description: Taxpayer registration date
        name:
          $ref: '#/components/schemas/TaxpayerName'
    ExtractionOptions:
      type: object
      description: Extractor options; check the available options for each extractor in [Extractions](https://docs.syntage.com/api-reference/extractions/overview#extractors)
      example:
        types:
        - I
        - E
        - P
        period:
          from: '2020-01-01T00:00:00.000Z'
          to: '2020-03-31T23:59:59.000Z'
    CursorCollection:
      type: object
      properties:
        '@context':
          type: string
        '@id':
          type: string
        '@type':
          type: string
          default: hydra:Collection
        hydra:membe

# --- truncated at 32 KB (35 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/syntage/refs/heads/main/openapi/syntage-extractions-api-openapi.yml