openapi: 3.0.1
info:
  license:
    name: Khipu Open Data API
    url: https://khipu.com
  title: AFIP
  description: ''
  version: v1.0
servers:
  - url: https://api.khipu.com
    description: Production
security:
  - JWT: []
  - Api-Key: []
paths:
  /v1/ar/services/afip.gob.ar/proof-cuit:
    post:
      summary: Proof CUIT
      description: >-
        Este método se conecta a la **Administración Federal de Ingresos
        Públicos**(AFIP) y retorna el comprobante de inscripción del CUIT.


        El uso del campo `CallbackUrl` desencadenará un proceso asíncrono y los
        datos resultantes se enviarán más tarde al webhook especificado. Esta es
        la forma preferida de interactuar con nuestros servicios, ya que asegura
        que se harán todos los esfuerzos para extraer los datos y cumplir  con
        su solicitud dentro de un plazo razonable. Si desea la respuesta de
        inmediato, omita el campo `CallbackUrl` pero tenga en cuenta que puede
        provocar tiempos de espera dependiendo del tamaño del resultado de los
        datos y las condiciones
      operationId: fetchProofCuit_1
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NoLoginRequiredRequest'
        required: true
      responses:
        '200':
          description: >-
            Successful operation. Returns a JSON object with the transactions
            for the specified account in the `Data` field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SituationResponseSyncOk'
        '202':
          description: >-
            Successful operation. Returns a JSON message informing the result of
            the request operation. The complete response, with the same schema
            as the sync version, will be sent to the callback URL provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseAsync'
        '400':
          description: Bad Request
        '401':
          description: Unauthorized - Invalid or missing credentials
        '404':
          description: Not found - Resource not available
        '500':
          description: Remote service error :(
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
    Api-Key:
      type: apiKey
      in: header
      name: x-api-key
  schemas:
    cuit:
      type: string
      maxLength: 20
      description: CUIT associated to the entity.
      example: '000011887755'
    NoLoginRequiredData:
      type: object
      description: Information needed to make the request.
      required:
        - Cuit
      properties:
        Cuit:
          $ref: '#/components/schemas/cuit'
    NoLoginRequiredRequest:
      type: object
      description: Object to make a request to the OpenData service.
      required:
        - RequestData
      properties:
        RequestData:
          $ref: '#/components/schemas/NoLoginRequiredData'
        CallbackUrl:
          maxLength: 255
          type: string
          description: URL to send the response message using a POST verb.
          example: https://my-api.my-business.com/api/open-data-response
    Identification:
      type: object
      description: Identification informed by the entity
      required:
        - Name
        - Cuit
      properties:
        Name:
          type: string
          description: Name of the Entity
          example: KHIPU ARGENTINA S.A.S.
        Cuit:
          type: string
          maxLength: 20
          description: CUIT associated to the entity.
          example: '000011887755'
        LegalForm:
          type: string
          description: Legal form of the entity
          example: SOC. POR ACCIONES SIMPLIFICADA
        ContractDate:
          type: string
          format: date
          description: Social contract date
          example: '2018-12-24'
    NationalTaxes:
      type: object
      description: Registered national taxes/regimes and registration date
      required:
        - Taxes
        - SupplementaryData
      properties:
        Taxes:
          type: array
          minItems: 0
          description: Array that contains the taxes/regimes.
          items:
            type: object
            required:
              - Name
              - Date
            properties:
              Name:
                type: string
                example: GANANCIAS SOCIEDADES
                description: Name of taxes/regimes.
              Date:
                type: string
                format: date
                example: 2021-12
                description: Registration date
        SupplementaryData:
          type: object
          description: Additional information on the taxes/regimes
          required:
            - Remark
          properties:
            Remark:
              type: string
              example: >-
                Contribuyente no amparado en los beneficios promocionales
                INDUSTRIALES establecidos por Ley 22021 y sus modificatorias
                22702 y 22973, a la fecha de emision de la presente constancia.
    Activities:
      type: object
      description: Registered national activities and registration date
      required:
        - Activities
        - ClosingMonth
      properties:
        Activities:
          type: array
          minItems: 0
          description: Array that contains the activies of the entity.
          items:
            type: object
            required:
              - Name
              - Date
              - Type
            properties:
              Name:
                type: string
                example: GANANCIAS SOCIEDADES
                description: Name of activity.
              Date:
                type: string
                format: date
                example: 2021-12
                description: Start date of activity
              Type:
                type: string
                example: Main
                description: Type of activity
        ClosingMonth:
          type: string
          description: Commercial year closing month
          example: '10'
    Residence:
      type: object
      description: Residence informed by the entity
      required:
        - Address
        - Village
        - City
      properties:
        Address:
          type: string
          example: BESARES 10000
        Village:
          type: string
          example: CHACRAS DE CORIA
        City:
          type: string
          example: 5505-MENDOZA
    ResponseData:
      type: object
      nullable: true
      description: Container for proof CUIT.
      properties:
        Proof:
          type: array
          items:
            type: object
            required:
              - Identification
              - NationalTaxes
              - Activities
              - Residence
            properties:
              Identification:
                $ref: '#/components/schemas/Identification'
              NationalTaxes:
                $ref: '#/components/schemas/NationalTaxes'
              Activities:
                $ref: '#/components/schemas/Activities'
              Residence:
                $ref: '#/components/schemas/Residence'
    error:
      type: object
      nullable: true
      description: >-
        Object with the error details, used when `Status=ERROR`. If `Status=OK`
        this field will be null. You can read a complete explanation of this
        object visiting [this link](https://docs.khipu.com/portal/en/errors/)
      example: null
      properties:
        Code:
          type: string
          description: Internal system code that identifies the error.
          example: E201
        Type:
          type: string
          enum:
            - RETRY_IMMEDIATELY
            - DO_NOT_RETRY
            - WAIT_4_HOURS_BEFORE_RETRY
            - RETRY_AFTER_NOTIFICATION
          description: >-
            Indicates how to treat this specific error code, based on the type
            of error.
          example: RETRY_IMMEDIATELY
        Description:
          type: string
          description: Description associated with the error code.
          example: >-
            El servicio destino utilizado para la extracción de datos no se
            encuentra disponible.
    SituationResponseSyncOk:
      type: object
      description: >-
        Object with the response from OpenData service for AFIP proof cuit, in
        synchronous mode.
      required:
        - OperationId
        - Status
        - Data
        - AdditionalInformation
        - Error
        - LifeSpan
      properties:
        OperationId:
          maxLength: 36
          type: string
          description: Unique identifier of the operation.
          example: 6baf6c19-e485-463b-ae24-a821b025c8a4
        Status:
          type: string
          enum:
            - OK
            - ERROR
          description: >-
            Operation status. `OK` means that the service was executed
            successfully even if it does not return Data. `ERROR` indicates that
            something happened that prevented the successful completion of the
            process.
          example: OK
        Data:
          $ref: '#/components/schemas/ResponseData'
          nullable: true
        AdditionalInformation:
          type: string
          description: >-
            This field can be used to display relevant information specific to
            the response, for instance indicating that the `Data` field is
            incomplete.
          example: null
          nullable: true
        Error:
          $ref: '#/components/schemas/error'
          nullable: true
        LifeSpan:
          type: string
          description: '`null` in sync requests.'
          example: null
          nullable: true
    ResponseAsync:
      type: object
      description: >-
        Object with the response from OpenData service for Proof of CUIT -
        Argentina, in asynchronous mode.
      required:
        - OperationId
        - Status
        - Data
        - AdditionalInformation
        - Error
        - LifeSpan
      properties:
        OperationId:
          maxLength: 36
          type: string
          description: Unique identifier of the operation.
          example: 6baf6c19-e485-463b-ae24-a821b025c8a4
        Status:
          type: string
          description: >-
            Operation status. When making async requests it will always return
            `OK`.
          example: OK
        Data:
          type: object
          description: '`null` in async requests.'
          example: null
        AdditionalInformation:
          type: string
          description: Operation message, can be used to display additional information.
          example: Data will be sent to the callback URL.
        Error:
          type: object
          description: '`null` in async requests.'
          example: null
        LifeSpan:
          type: string
          format: date-time
          description: >-
            Max estimated delivery date for async requests, in ISO 8601 date
            format, UTC timezone.
          example: 2017-07-22T00:00:00-0400
