Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

CoLT API v3 is a multitenancy web service. A tenant is an instance that is isolated from other instances and has its own data and configuration.

Endpoints are URLs providing access to the web services allowing certificate enrollment and issuance.

The API is designed to establish a communication channel via SSL Client Authentication, so when establishing the HTTPS channel, you must present a valid client certificate as part of the authentication mechanism.

Additionally, the user and password must be presented. The values assigned have the following format (ask CertiSur for the values assigned to your company).

Operations and notation

Every operation is accessed via a specific URL. The endpoint contains a <tenant> value.

  • Each organization that uses this service will access its own proprietary console via its <tenant>. Please, ask CertiSur for the value assigned to your organization. Eg <tenant>="acme"

List of <operations>

  • sessions

  • individuals

  • requests

  • passcodes

  • revokes

  • certificates

Example: https://homo-panel.certisur.com:5443/acme/api/v3/individuals/

where “acme” is the name of the tenant.

The following sections describe in detail each operation, along with its input and output parameters.

Table of Contents
minLevel1
maxLevel2


Authentication

User authentication

POST

<tenant>/api/v3/auth/sign_in/

Input parameters

BODY

Code Block
{
    "email":"{{colt_be_admin_user}}",
    "password":"{{colt_be_admin_password}}"
}

Response

HEADER

access-token

client

uid

Info

Each new request to the WS requires to include in the headers those parameters returned as HTTP response headers during the authentication with email and password.

Info

New HTTP response headers are returned with each order, and those headers should be used as an authentication mechanism in the next request.

Image RemovedImage Added

You can find additional information on managing tokens in Appendix I – Authentication Token


Individuals

Obtain data from an individual. A parameter is passed to it and it returns all the individuals that match the indicated parameter. If no parameter is passed, it returns all the individuals.

POST

<tenant>/api/v3/individuals/search

Input parameters

It is possible to search by null and use wildcards (%) to retrieve a specific set of individuals. Ej

BODY

Code Block
individual: {
   first_name: "%ri%",
   company_attributes: { name: "Musim%"  }
}

All the possible fields:

Code Block
:individual = (
     :national_number, 
     :national_number_type, 
     :first_name, 
     :last_name, 
     :email, 
     :company_attributes: {
         :name,
         :national_number
      },
      :birthdate, 
      :address, 
      :country, 
      :phone
  )

Response

BODY

Code Block
Individual Data


List

Obtain a list of the 10 last loaded individuals.

GET

<tenant>/api/v3//individuals/

Input parameters

none

Response

BODY

Code Block
Individual Data (x 10)


Create

Create an individual.

POST

<tenant>/api/v3/individuals

Input parameters

It is possible to search by null and use wildcards (%) to retrieve a specific set of individuals. Ej

BODY

Code Block
{
  :national_number, 
  :national_number_type, 
  :first_name, 
  :last_name, 
  :email, 
  :birthdate,
  :address, 
  :country, 
  :phone, 
  :company_attributes:{:name,:national_number}, 
  :field_0
  …
  field_5
}

Required fields:

Code Block
:national_number, 
:national_number_type, 
:first_name, 
:last_name, 
:email

Response

BODY

Code Block
Individual Data

Note

If a user exists with the same "national_number_type" and "national_number" an error with code 5105.

Code Block
{
    "code": "5105",
    "description": "Ya existe un individuo con este número y tipo de identificador"
}


Enroll Request

Create

Create an Enrollment Request

POST

<tenant>/api/v3/requests/

Input parameters

BODY

Code Block
"individual": {
    "id", 
    "national_number_type", 
    "national_number"
  )

"request": {
    "field_1", 
    "field_2", 
    "channel_policy_id", 
    "approve"
  }

"policy": {
    "name"
  }

The individual parameter works in the same way as the individual search and must match just one record.

The content of field_1 to field_5 depends on is Tenant.

The content of the channel_policy_id field contains the identifier number of the Policy Keystore to assign to the request.

approve equals to ‘true’ assign an approvement from the Enrollment Administrator account to a new request.

If the policy_name is not sent, the request is created without the associated policy.

All the possible fields:

Code Block

Response

BODY

Code Block
 Enrollment request

Request + Mechanism

Create

POST

<tenant>/api/v3/requests/

Input parameters

It works the same way as the creation of requests but with the addition of the following parameters:

BODY

Code Block
"request": {
    ...
    "mechanism":"onboarding" | "autoenroll",
    "mobile_number":"+nnnnnnnnnnnnn",
    "app_name"": "SecureDoc"
    "approve": "true" | "false"
}

Response

Returns a mechanism_request record.

BODY

Code Block
{
    "id",
    "request": { ... },
    "app_name",
    "origin_request_id",
    "mechanism_request_id",
    "mechanism_status",
    "token",
    "mobile_number",
    "enroll_url"
}

id

Internal Origin Request ID (don’t use)

origin_request_id

Random Hexa number, representing the Origin-Request-ID.

request

Request record

app_name

name of the application used to generate this request, eg: SecureDOC.

mechanism_request_id

value used by an external validation system to identify the validation process related to this request.

This value is used, by example, for the Biometric Validation System.

mobile_number

Mobile number used for whatsapp onboarding.

enroll_url

If present, URL where the end-user must be redirectec to complete the certificate enrollment.

Response Example:

Code Block
{
    "id": 1,
    "request": {
        "company_name": "CertiSur S.A.",
        "state": "Ciudad Autonoma de Buenos Aires",
        "locality": "Ciudad Autonoma de Buenos Aires",
        "id": 1,
        "individual_id": 1,
        "common_name": "Armando",
        "national_number_type": "DNI",
        "national_number": "12342342",
        "country": "AR",
        "first_name": "Armando",
        "last_name": "33",
        "status": "enabled",
        "email": "jdoe@gmail.com",
        "request_type": "Initial",
        "approved": false,
        "policy": {
            "name": "acme",
            "friendly_name": "Acme Firma Digital",
            "validity": 365
        },
        "enabled_keystores": {
            "win_enh": {
                "security_policy": {
                    "capiSecPolicy": {
                        "id": null,
                        "mask": "1"
                    }
                }
            }
        },
        "pin_certificate": null,
        "adsec_op_type": "Initial",
        "act_as_initial": false
    },
    "app_name": "undef_app_name",
    "origin_request_id": "B2A768215FDFSDFD84D300FB8B2B9",
    "mechanism": "autoenroll",
    "mechanism_request_id": null,
    "mechanism_status": "pending",
    "token": "A88E9526F31C5DE81FDFFD8B74BE8FD256F5C",
    "mobile_number": "+5491161590622",
    "first_name": "Armando",
    "last_name": "Carratala",
    "enroll_url": "http://localhost:5003/acme/pickup?origin_request_id=B2A768215FD84D300FB8B2B9&auth_token=A88E9526F31C5DE818B74BE8FD256F5C"
}

Show

It returns a request along with its data for origin_requests the same way as returned by CREATE.

GET

<tenant>/api/v3/requests/{{origin_request_id}}


Update

Allows updating some values or fields of a Mechanism Request.

It sends the result of the onboarding process in order to approve or reject a request.

PUT

<tenant>/api/v3/mechanism_request/

Input parameters

BODY

Code Block
:origin_request = (
    :origin_request_id,
    :mechanism_request_id,
    :mechanism_status,
    :first_name,
    :last_name,
    :mobile_number
  )

All the possible fields:

origin_request_id

Random Hexa number, representing the Origin-Request-ID.

app_name

name of the application used to generate this request, eg: SecureDOC.

mechanism_request_id

value used by an external validation system to identify the validation process related to this request.

This value is used, by example, for the Biometric Validation System.

mechanism_status

could be "autenticado" or "no autenticado"

mobile_number

Mobile number used for whatsapp onboarding.


Passcodes

Create

(POST)

POST

<tenant>/api/v3/individuals/search

Input parameters

BODY

Code Block

All the possible fields:

Code Block

Response

BODY

Code Block Code Block url = <endpoint>/passcodes/ (POST)

USE: Create Passcodes associated with a Request (request) for an Individual. When making a new invocation, it will generate a new Passcode no matter than if the previous one is still enabled and or without use.

Params:

Code Block :

POST

<tenant>/api/v3/individuals/search

Input parameters

BODY

Code Block
:request=(:id)
+:authentication_header Return:

Response

BODY

Code Block
{
 
The
 "passcode
tied to the request is created and the associated passcode data is returned. Return = headers(:access_token, :token_type, :client, :expiry, :uid)

NOTE: If the request is executed two or more times on the same request (: id), it will generate a new pair of keys associated with each request

Code Block

{
"passcode_status": "enabled",
"pin_postal": "PHBXFE8H",
"pin_email": "ZK99NUY4"
}

Revokes

Create (POST)

POST

_status": "enabled",
  "pin_postal": "PHBXFE8H",
  "pin_email": "ZK99NUY4"
}

Revoke Request

Create

Create a revoke request

POST

<tenant>/api/v3/individuals/searchrevokes

Input parameters

BODY

Code Block

All the possible fields:

Code BlockResponse

All the parameters are optional. The system will look for the certificates that match all the provided filters. It is recommended to send more than one parameter to limit the response to the specific individual and desired certificate.

If there is only one valid and non-expired certificate matched with the applied filters, a revocation request is created and returned.

BODY

Code Block
Code Block

url = <endpoint>/revokes/ (POST)

USE: Create a certificate revocation request

Params:

Code Block :certificate=(:serial),
:certificate=(:serial),
:policy=(:name),
:revoke=(:revocation_reason, :approve),
:individual=(
    :id, 
    :national_number_type, 
    :national_number, 
    :first_name, 
    :last_name, 
    :email, 
    :birthdate, 
    :address, 
    :country, 
    :phone
) +:authentication_header

All the parameters are optional. The system will look for the certificates that match all the provided filters. It is recommended to send more than one parameter to limit the response to the specific individual and desired certificate.

Alternative values for revocation_reason:

  • ‘Replace’

  • 'Key compromise'

  • 'CA
    )

    Alternative values for revocation_reason:

    • ‘Replace’

    • 'Key compromise'

    • 'CA compromise'

    • 'Affiliation changed'

    • 'Superseded'

    • 'Cessation of operation'

    • 'Certificate hold'

    • 'Remove from CRL'

    • 'Privilege withdrawn'

    • 'AA compromise'

    • 'Unspecified'

    Return:

    If there is only one valid and non-expired certificate matched with the applied filters, a revocation request is created and returned. When success, the revoke created is returned along with HTTP code 200

    Code Block Return = {:id,

    Response

    If success: a HTTP(200)

    BODY

    Code Block
    {
      :id, 
      :revocation_reason, 
      :status, 
      :policy_name, 
      :individual_name,
     
      
    :certificate
    {:serial,:data}} Return = headers(:access_token, :token_type, :client, :expiry, :uid)

    Example:

    Image Removed

    In case of error code ERROR_CREATE_REVOKE (5106) is returned along with an HTTP code 400:

    Code Block
    
    Return = { "code": "5106", "description": "..." }
    
    Return = headers(:access_token, :token_type, :client, :expiry, :uid)
    

    Possible description values:

    • No certificate has been found matching the filter provided

    • More than one certificate match the filter provided

    • Not enough privileges to revoke a certificate belonging to the policy <policy_name>

    • There is already an open revoke

    If you have more than one valid certificate matching the filter provided, the method returns an error description stating that several certificates comply with the filter. You must refine your search.

    Example:

    Image Removed

    Search (POST)

    Code Block
    
    url = <endpoint>/revokes/search (POST)

    USE: return revoked certificates data

    Params:

    Code Block
    
    :from_date=(:fecha_desde),
    :to_date=(:fecha_hasta),
    
    +:authentication_header
    
    from_date and to_date fields format is: AAAA-MM-DD example: “2019-02-26”
    

    Return:

    Code Block
    
    Return = :id, :revocation_reason, :status, :policy_name, :individual_name, :certificate(:serial)
    
    Return = headers(:access_token, :token_type, :client, :expiry, :uid)
    
    NOTE:
     {
        :serial,
        :data
      }
    }

    Example:

    Image Added

    If error: a HTTP(400)

    BODY

    Code Block
    { 
      "code": "5106", 
      "description": "..." 
    }

    Possible description values:

    • No certificate has been found matching the filter provided

    • More than one certificate matches the filter provided

    • Not enough privileges to revoke a certificate belonging to the policy <policy_name>

    • There is already an open revoke

    Example:

    Image Added

    Search

    POST

    <tenant>/api/v3/revokes/search

    Input parameters

    BODY

    Code Block
    :from_date=(:fecha_desde),
    :to_date=(:fecha_hasta),

    All the possible fields:

    Code Block
    from_date and to_date fields format is: AAAA-MM-DD example: “2019-02-26”

    The verification of the revocation status for a specific certificate must be done through the Certificates search.

    Alternative values for revocation_reason:

    • 'Replace'

    • 'Key compromise'

    • 'CA compromise'

    • 'Affiliation changed'

    • 'Superseded'

    • 'Cessation of operation'

    • 'Certificate hold'

    • 'Remove from CRL'

    • 'Privilege withdrawn'

    • 'Privilege withdrawn'

    • 'AA compromise'

    • 'Unspecified''AA compromise'

    • 'Unspecified'

    Response

    BODY

    Code Block
    {
      :id, 
      :revocation_reason, 
      :status, 
      :policy_name, 
      :individual_name, 
      :certificate (:serial)
    }

    Example:

    Code Block
    
    {"revoke":{
          "id":1,
          "revocation_reason":"Unspecified",
          "status":"enabled",
          "policy_name":"bolsas_cereales_g2",
          "individual_name":"Juan Vinsmoke", 
          "serial":"3BCDBA3H7QWMM8B962607"
       }
    }
    

    Certificates

    Search

    (POST)

    Returns Individual certificate data

    POST

    <tenant>/api/v3/

    individuals

    certificates/search

    Input

    parameters

    BODY

    Code Block

    All the possible fields:

    Code Block

    Response

    BODY

    Code Block
    Code Block
    
    url = <endpoint>/certificates/search (POST)

    USE: returns Individual certificate data

    Params:

    parameters

    BODY

    Code Block
    :certificate= (
      :serial, 
      :id, 
      :from_date, 
      :to_date
    ),
    
    :policy=(
      :name
    ),
    
    :individual=(
      :id, 
      :national_number_type, 
      :national_number, 
      :first_name, 
      :last_name
    , :email, :birthdate, :address, :country
    ,
    :phone) +:authentication_header from_date and
     
    to_date
    
    
    fields
     
    format
     
    is
    :email, 
    AAAA-MM-DD
    
    
    example:
     
    “2019-02-26”
     

    Return:

    Code Block = Certificate data Return = headers(:access_token, :token_type, :client, :expiry, :uid)
    :birthdate, 
      :address, 
      :country, 
      :phone
    )

    Alternative values for status: ‘Revoked', ‘Expired', ‘Valid'

    Response

    BODY

    Code Block
    Certificate data

    Example:

    Code Block
    
    {"certificates": [
        {
          "id": 20,
          "serial": "22190A2193BCE48A3D05B9CA67911094",
          "subject_dn": "/O=Bolsa de Comercio de Rosario/OU=ROSARIO G2/OU=  Empresa - 2017031705/OU=Documento – DNI16000000/CN=BCR Blanco/emailAddress=bcrblanco@bcr.com.ar",
          "issuer_dn": "/C=AR/O=Bolsa de Comercio de Rosario/OU=Symantec Trust Network/OU=FOR TEST PURPOSES ONLY/CN=TEST Autoridad Certificante Bolsa de Comercio de Rosario – G2",
          "not_before_date": "2017-09-17T00:00:00Z",
          "not_after_date": "2018-09-17T23:59:59Z",
          "individual_id": 4,
          "policy_id": 2,
          "created_at": "2017-09-17T20:33:23Z",
          "status": "valid"
        }
      ]
    }

    Alternative values for “status”: ‘R’evoked, ‘E’xpired, ‘V’alid

    Index (Get)

    POST

    <tenant>/api/v3/individuals/search

    Input parameters

    BODY

    Code Block

    All the possible fields:

    Code Block

    Response

    BODY

    Code Block
    Code Block
    
    url = <endpoint>/certificates/ (GET)
    USE: Returns


    List

    List the last 20 issued certificates.

    GET

    <tenant>/api/v3/certificates

    Return:

    /

    Input parameters

    none

    Response

    BODY

    Code Block
    List 
    Data
    of
    the last 20
     certificates
    issued Return = headers(:access_token, :token_type, :client, :expiry, :uid)

    Authentication Description

    The following information can be useful to understand the protocol used to authenticate each endpoint.

    ​Appendix I – Authentication Token

    The Web Services authentication process is based on the token management documentation published in:

    GitHub - lynndylanhurley/devise_token_auth: Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.

    About token management

    Tokens should be invalidated after each request to the API. The following diagram illustrates this concept:


    During each request, a new token is generated. The access-token header that should be used in the next request is returned in the access-token header of the response to the previous request. The last request in the diagram fails because it tries to use a token that was invalidated by the previous request.

    The only case where an expired token is allowed is during batch requests.

    About batch requests

    By default, the API updates the auth token for each request. But sometimes it's necessary to make several concurrent requests to the API, for example:

    Batch request example

    Code Block
    $scope.getResourceData = function() {
    
      $http.get('/api/restricted_resource_1').success(function(resp) {
        // handle response
        $scope.resource1 = resp.data;
      });
      $http.get('/api/restricted_resource_2').success(function(resp) {
        // handle response
        $scope.resource2 = resp.data;
      });
    
    };


    In this case, it's impossible to update the access-token header for the second request with the access-token header of the first response because the second request will begin before the first one is complete. The server must allow these batches of concurrent requests to share the same auth token. This diagram illustrates how batch requests are identified by the server:


    The "5 second" buffer in the diagram is the default used this API.

    The following diagram details the relationship between the client, server, and access tokens used over time when dealing with batch requests:

    Note that when the server identifies that a request is part of a batch request, the user's auth token is not updated. The auth token will be updated for the first request in the batch, and then that same token will be returned in the responses for each subsequent request in the batch (as shown in the diagram).