swagger: '2.0'
info:
  version: '1.0.0'
  title: Address Verification API
  description: "The address verification API allows you to validate if the requested address is a data endorsed by the company of whom it claims to be endorsed, for this API version: CFE.</p><br/><br><img src='https://developer.circulodecredito.com.mx/sites/default/files/2020-10/circulo_de_credito-apihub.png' width='240'/></p><br/>"
  contact:
    email: api@circulodecredito.com.mx
host: services.circulodecredito.com.mx
basePath: /address-verification/v1/
securityDefinitions:
  api_key:
    type: apiKey
    name: api_key
    in: header
schemes:
- https
consumes:
- application/json
produces:
- application/json
paths:
  /verifications:
    post:
      description: ''
      summary: createVerification
      tags:
      - Verifications
      operationId: createVerification
      deprecated: false
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - name: x-signature
        in: header
        required: true
        type: string
        description: Generated signature with private key
      - name: x-api-key
        in: header
        required: true
        type: string
        description: ConsumerKey from developers portal
      - name: username
        in: header
        required: true
        type: string
        description: Círculo de Crédito username
      - name: password
        in: header
        required: true
        type: string
        description: Círculo de Crédito password
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: 'Request object that has to be verified, if your process has no acceptaced valitacion step, please send the defaults values for the  fields acceptanceDate: 2000-01-01T00:00:00.00Z, acceptance: N'
        schema:
          $ref: '#/definitions/VerificationRequest'
      responses:
        '200':
          description: Correct response from a verification
          schema:
            $ref: '#/definitions/ResponseVerification'
          headers: {}
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '400'
                message: Missign parameters {requestId, subscriptionId, serviceCode, contractNumber, acceptanceDate, acceptance, address}.
          headers: {}
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '401.1'
                message: Unauthorized, invalid x-api-key.
              - code: '401.2'
                message: Unauthorized, invalid credentials.
              - code: '401.3'
                message: Unauthorized, you do not have the product.
              - code: '401.4'
                message: Unauthorized, you do not have access to the resource.
          headers: {}
        '403':
          description: Forbidden.
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '403.1'
                message: We could not verify the signature, x-signature is invalid.
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '404'
                message: The service is not available for this request.
          headers: {}
        '405':
          description: METHOD NOT ALLOWED
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '405.1'
                message: The method is not allowed
          headers: {}
        '429':
          description: TOO MANY REQUESTS
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '429.1'
                message: Too many requests
          headers: {}
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '500'
                message: There was an unexpected error, try again later.
              - code: '500.2'
                message: The request could not be processed.
          headers: {}
        '503':
          description: Service unavailable.
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '503'
                message: Service unavailable.
          headers: {}
  /verifications/{requestId}:
    get:
      description: Returns a previous verification result
      summary: getVerificationByrequestId
      tags:
      - Verifications
      operationId: getVerificationByrequestId
      deprecated: false
      produces:
      - application/json
      parameters:
      - name: x-signature
        in: header
        required: true
        type: string
        description: Generated signature with private key
      - name: x-api-key
        in: header
        required: true
        type: string
        description: ConsumerKey from developers portal
      - name: username
        in: header
        required: true
        type: string
        description: Círculo de Crédito username
      - name: password
        in: header
        required: true
        type: string
        description: Círculo de Crédito password
      - name: requestId
        in: path
        required: true
        type: string
        description: ID of verification request to return
      responses:
        '200':
          description: successful operation
          schema:
            $ref: '#/definitions/VerificationResponse200'
          headers: {}
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '400'
                message: Missign parameters {requestId, subscriptionId, serviceCode, contractNumber, acceptanceDate, acceptance, address}.
          headers: {}
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '401.1'
                message: Unauthorized, invalid x-api-key.
              - code: '401.2'
                message: Unauthorized, invalid credentials.
              - code: '401.3'
                message: Unauthorized, you do not have the product.
              - code: '401.4'
                message: Unauthorized, you do not have access to the resource.
          headers: {}
        '403':
          description: Forbidden.
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '403.1'
                message: We could not verify the signature, x-signature is invalid.
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '404'
                message: The service is not available for this request.
          headers: {}
        '405':
          description: METHOD NOT ALLOWED
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '405.1'
                message: The method is not allowed
          headers: {}
        '429':
          description: TOO MANY REQUESTS
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '429.1'
                message: Too many requests
          headers: {}
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '500'
                message: There was an unexpected error, try again later.
              - code: '500.2'
                message: The request could not be processed.
          headers: {}
        '503':
          description: Service unavailable.
          schema:
            $ref: '#/definitions/Errors'
          examples:
            application/json:
              errors:
              - code: '503'
                message: Service unavailable.
          headers: {}
definitions:
  ResponseVerification:
    type: object
    properties:
      dateTime:
        type: string
        format: date-time
        example: "2020-04-12T22:20:50.52Z"
      operation:
        type: string
        example: "accepted"
      message:
        type: string
        example: "accepted"
      subscriptionId:
        type: string
        example: "b7c0dac7-ba6f-4756-931d-9d0e84ace01b"
      requestId:
        type: string
        example: "026f24e8-1cc9-4549-ac05-b375bdf6b8ce"
  Error:
    title: Error
    description: error
    type: object
    properties:
      code:
        description: Error Code
        example: '400'
        type: string
      message:
        description: Descriptive and human-readable error message.
        example: External data source not available.
        type: string
  Errors:
    title: Errors
    description: A list of errors.
    type: object
    properties:
      errors:
        description: List of errors
        type: array
        items:
          $ref: '#/definitions/Error'
  Holder:
    title: Holder
    type: object
    properties:
      name:
        example: Vlad
        type: string
        minLength: 1
        maxLength: 64
        pattern: ^([A-Za-zÑñ ])+$
      secondName:
        example: Eddie
        type: string
        minLength: 1
        maxLength: 64
        pattern: ^([A-Za-zÑñ ])+$
      lastName:
        example: Teples
        type: string
        minLength: 1
        maxLength: 64
        pattern: ^([A-Za-zÑñ ])+$
      secondLastName:
        example: Vlodiling
        type: string
        minLength: 1
        maxLength: 64
        pattern: ^([A-Za-zÑñ ])+$
  Address:
    title: Address
    type: object
    properties:
      streetAddress:
        example: love street 525
        type: string
        minLength: 1
        maxLength: 100
        pattern: ^([\s]?[\-\.,_A-Za-z0-9áéíóúñüÁÉÍÓÚÑÜ]?)+$
      settlement:
        example: Centro
        type: string
        minLength: 1
        maxLength: 100
        pattern: ^([\s]?[\-\.,_A-Za-z0-9áéíóúñüÁÉÍÓÚÑÜ]?)+$
      city:
        example: Cuahutemoc
        type: string
        minLength: 1
        maxLength: 100
        pattern: ^([\s]?[\-\.,_A-Za-záéíóúñüÁÉÍÓÚÑÜ]?)+$
      state:
        allOf:
        - $ref: '#/definitions/State'
        - example: CDMX
      zipCode:
        example: '06000'
        type: string
        minLength: 5
        maxLength: 5
        pattern: ^[0-9]{5}$
    required:
    - streetAddress
    - settlement
    - city
    - state
    - zipCode
  VerificationRequest:
    title: VerificationRequest
    type: object
    properties:
      requestId:
        example: 7c8a0230-36e0-43f4-9b7a-581dc55ea9c3
        type: string
        format: uuid
      subscriptionId:
        example: 7c8a0230-36e0-43f4-9b7a-581dc55ea9c3
        type: string
        format: uuid
      serviceCode:
        allOf:
        - $ref: '#/definitions/ServiceCode'
        - example: CFE
      contractNumber:
        type: string
        minLength: 1
        maxLength: 20
        pattern: ^[0-9a-zA-Z\\_-]{1,20}$
        example: 1234567890
      acceptanceDate:
        type: string
        format: date-time
        description: 'If your process has no acceptaced valitacion step, please send the defaults values for the field acceptanceDate: 2000-01-01T00:00:00.00Z'
        example: "2020-04-12T22:20:50.52Z"
      acceptance:
        type: string
        description: 'If your process has no acceptaced valitacion step, please send the defaults values for the field acceptance: N'
        enum: ['Y','N']
        minLength: 1
        maxLength: 1
        example: "Y"
      holder:
        $ref: '#/definitions/Holder'
      address:
        $ref: '#/definitions/Address'
    required:
    - requestId
    - subscriptionId
    - serviceCode
    - contractNumber
    - address
  VerificationResponse200:
    type: object
    properties:
      code:
        type: number
        example: 200
      message:
        type: string
        example: The request has been completed successfully
      dateTime:
        type: string
        description: Date and time of the acknowledge. As defined by date-time -
          RFC3339.
        format: date-time
        readOnly: true
        example: 2020-04-12T22:20:50.52Z
      data:
        type: object
        properties:
          request:
            $ref: '#/definitions/VerificationRequest'
          response: 
            type: object
            properties:
              indexes:
                type: object
                properties:
                  certaintyIndex:
                    type: number
                    example: 0.6
                  coincidenceIndex:
                    type: number
                    example: 0.5
              errors:
                description: List of errors
                type: array
                items:
                  properties:
                    code:
                      description: Error Code
                      example: '404.1'
                      type: string
                    message:
                      description: Descriptive and human-readable error message.
                      example: The contract number was not founded in the verification service.
                      type: string

  Data:
    title: Data
    type: object
    properties:
      request:
        $ref: '#/definitions/VerificationRequest'
      response:
        $ref: '#/definitions/Response'
  Response:
    title: Response
    type: object
    properties:
      indexes:
        $ref: '#/definitions/Indexes'
  Indexes:
    title: Indexes
    type: object
    properties:
      certaintyIndex: 
        example: 1
        type: number
        description: certaintyIndex
      coincidenceIndex: 
        example: 0.8
        type: number
        description: coincidenceIndex
  ServiceCode:
    title: ServiceCode
    example: CFE
    type: string
    enum:
    - CFE
    - TOTAL_PLAY
  State:
    title: State
    example: CDMX
    type: string
    enum:
    - AGS
    - BC
    - BCS
    - CAMP
    - COAH
    - COL
    - CHIS
    - CHIH
    - CDMX
    - DGO
    - GTO
    - GRO
    - HGO
    - JAL
    - MEX
    - MICH
    - MOR
    - NAY
    - NL
    - OAX
    - PUE
    - QRO
    - QROO
    - SLP
    - SIN
    - SON
    - TAB
    - TAMP
    - TLAX
    - VER
    - YUC
    - ZAC
security: []
tags:
- name: Verifications
  description: Address verification API
externalDocs:
  url: http://swagger.io
  description: Find out more about Swagger
