Skip to content
Staircase

Rule

A declarative rules engine underneath eligibility and validation across products, including model-assisted rule authoring.

Rules are data. A rule names the fields it reads, the condition it tests and the result it produces, and the engine evaluates it against a canonical record — which is what lets an eligibility rule change without a deployment of the product that runs it.

The same engine backs the conditional requirements in the model's semantic validation and the eligibility logic in the mortgage products.

How it works

Rule authoring is assisted rather than automated. A model drafts a rule from a stated requirement, and the draft is validated against the model's own schema before it is accepted — so a generated rule that references a field that does not exist fails at authoring time rather than at evaluation time.

Operations

Engine

POST /engine/data/jobs

Invoke Ruleset

invokeRuleset

Invoke Ruleset: processes the input collection(s) according to the Ruleset operation as below:

  • SELECTIVE_DATA_MERGE: merge collections in a new collection.
  • Input: Staircase Collection(s).
  • Process: Create new collection by running the ruleset on the input collections.
  • Output: A new collection generated from running the ruleset.
  • DATA_INFERRING: modify existing collection.
  • Input: Staircase Collection.
  • Process: Modify the collection by running the Ruleset.
  • Output: Modified collection.

Callback URL: The callback is an POST HTTP call with a JSON request body with the following schema:

Show the rest
{
"type": "object",
"$schema": "",
"required": [
"job_id",
"job_status"
],
"properties": {
"job_id": {
"type": "string",
"format": "ulid"
},
"job_status": {
"type": "string",
"enum": [
"COMPLETED",
"FAILED"
]
},
"output": {
"type": "object",
"required": [
"data",
"metadata"
],
"properties": {
"data": {
"type": "object"
},
"metadata": {
"type": "object",
"description": "Metadata about output data",
"properties": {
"status": {
"type": "string",
"description": "Status of the data validity",
"enum": [
"HAS_VALIDATION_ERRORS"
]
},
"status_message": {
"type": "string",
"description": "Status description"
}
}
}
}
},
"failure_reason": {
"type": "string"
}
}
}

Example for completed job:

{
"job_id": "01FMPQ735YKJ0TFBXX3YKVWK7P",
"job_status": "COMPLETED",
"output": {
"metadata": {
"status": "HAS_VALIDATION_ERRORS",
"status_message": "Data has at least 1 object in $.data_validation_metadata with a has_validation_code >= 400"
},
"data": {
"documents": [
{
"@id": "01FKYN27FT44KKTAEC58S6Y6FY",
"@type": "closing_disclosure",
"has_document_date": {
"has_value": "2021-01-29"
},
"has_document_misclassified_indicator": {
"has_value": "false"
}
}
],
"loan_terms": [
{
"@id": "01FKYN27FH8P2WS39Z5KSV7CEA",
"@type": "loan_terms",
"has_hazard_insurance_escrow_required_indicator": {
"has_value": "true"
},
"has_initial_principal_and_interest_payment_amount": {
"has_value": 98.3
},
"has_prepaid_taxes_months_count": {
"has_value": "7"
},
"has_tax_escrow_required_indicator": {
"has_value": "true"
}
}
],
"payments": [
{
"@id": "01FKYN27FJN6M8MMFMH4PDSG5E",
"@type": "loan_payment",
"has_late_charge_rate_percent": {
"has_data_extraction_confidence_score": 95,
"has_value": "5"
}
}
]
}
}
}

Example for failed job:

{
"job_id": "01FMQCF7QW6BHZC7NC7XRRHRPN",
"job_status": "FAILED",
"failure_reason": "Unexpected error."
}

Example callback for running Ruleset Invocation:

The endpoint returns the job_id that can be tracked here

Request
application/json
{
  "ruleset_name": "selective_merge_ruleset",
  "input": {
    "data_objects": [
      {
        "data": {
          "loans": [
            {
              "@id": "01FKYN27FFCBT3GHGNGWQ9S6CK",
              "@type": "loan",
              "with_insurance": [
                "01FKYN27FHSK0MFKHD9WXC819J"
              ],
              "with_loan_terms": [
                "01FKYN27FH8P2WS39Z5KSV7CEB"
              ],
              "with_payment": [
                "01FKYN27FJN6M8MMFMH4PDSG5E"
              ]
            }
          ],
          "insurance": [
            {
              "@id": "01FKYN27FHSK0MFKHD9WXC819J",
              "@type": "mortgage_insurance",
              "has_insurance_escrowed_indicator": {
                "has_value": "true"
              }
            }
          ],
          "loan_terms": [
            {
              "@id": "01FKYN27FH8P2WS39Z5KSV7CEB",
              "@type": "loan_terms",
              "has_hazard_insurance_escrow_required_indicator": {
                "has_value": "true"
              },
              "has_initial_principal_and_interest_payment_amount": {
                "has_value": 91.5
              },
              "has_loan_amortization_type": {
                "has_value": null
              },
              "has_prepaid_taxes_months_count": {
                "has_value": "7"
              },
              "has_tax_escrow_required_indicator": {
                "has_value": "true"
              }
            }
          ],
          "payments": [
            {
              "@id": "01FKYN27FJN6M8MMFMH4PDSG5E",
              "@type": "loan_payment",
              "has_late_charge_rate_percent": {
                "has_value": "5",
                "has_data_extraction_confidence_score": 95
              }
            }
          ],
          "documents": [
            {
              "@id": "01FKYN27FT44KKTAEC58S6Y6FY",
              "@type": "closing_disclosure",
              "has_document_date": {
                "has_value": "2021-01-29"
              },
              "has_document_misclassified_indicator": {
                "has_value": "false"
              }
            }
          ],
          "mortgage_products": [
            {
              "@id": "01FKYN27FX3A94JY49JYCW7RG0",
              "@type": "ide"
            }
          ]
        }
      }
    ],
    "collections": [
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4E5E6M9ZJ5TRMJPRQ99C9"
      },
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4E9BXJZA254VTENY1RW9H"
      },
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4EGKZMA6T659B9XP64G4W"
      }
    ]
  },
  "callback_url": "https://notify.me/please"
}
Response
application/json

Created.

{
  "ruleset_name": "selective_merge_ruleset",
  "job_id": "01FJC4JGKFX3VYB0EZ75JNY4J6",
  "job_status": "STARTED",
  "input": {
    "data_objects": [
      {
        "data": {
          "loans": [
            {
              "@id": "01FKYN27FFCBT3GHGNGWQ9S6CK",
              "@type": "loan",
              "with_insurance": [
                "01FKYN27FHSK0MFKHD9WXC819J"
              ],
              "with_loan_terms": [
                "01FKYN27FH8P2WS39Z5KSV7CEB"
              ],
              "with_payment": [
                "01FKYN27FJN6M8MMFMH4PDSG5E"
              ]
            }
          ],
          "insurance": [
            {
              "@id": "01FKYN27FHSK0MFKHD9WXC819J",
              "@type": "mortgage_insurance",
              "has_insurance_escrowed_indicator": {
                "has_value": "true"
              }
            }
          ],
          "loan_terms": [
            {
              "@id": "01FKYN27FH8P2WS39Z5KSV7CEB",
              "@type": "loan_terms",
              "has_hazard_insurance_escrow_required_indicator": {
                "has_value": "true"
              },
              "has_initial_principal_and_interest_payment_amount": {
                "has_value": 91.5
              },
              "has_loan_amortization_type": {
                "has_value": null
              },
              "has_prepaid_taxes_months_count": {
                "has_value": "7"
              },
              "has_tax_escrow_required_indicator": {
                "has_value": "true"
              }
            }
          ],
          "payments": [
            {
              "@id": "01FKYN27FJN6M8MMFMH4PDSG5E",
              "@type": "loan_payment",
              "has_late_charge_rate_percent": {
                "has_value": "5",
                "has_data_extraction_confidence_score": 95
              }
            }
          ],
          "documents": [
            {
              "@id": "01FKYN27FT44KKTAEC58S6Y6FY",
              "@type": "closing_disclosure",
              "has_document_date": {
                "has_value": "2021-01-29"
              },
              "has_document_misclassified_indicator": {
                "has_value": "false"
              }
            }
          ],
          "mortgage_products": [
            {
              "@id": "01FKYN27FX3A94JY49JYCW7RG0",
              "@type": "ide"
            }
          ]
        }
      }
    ],
    "collections": [
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4E5E6M9ZJ5TRMJPRQ99C9"
      },
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4E9BXJZA254VTENY1RW9H"
      },
      {
        "transaction_id": "01FJC4DRGV5KNWWJZ9Y3D4X3KG",
        "collection_id": "01FJC4EGKZMA6T659B9XP64G4W"
      }
    ]
  }
}
Request bodyapplication/json
4 fields
FieldTypeDescription
transaction_idstringTransaction IDExample 01GKMKNNBG21DZ5GZXAQVS7AQC
ruleset_namerequiredstringRuleset nameExample Some Ruleset
inputrequiredobjectData for the processing
data_objectsobject[]The array of data objects that need to be processed
datarequiredobjectThe data in staircase v2 format
collectionsobject[]The array of collection IDs that need to be processed
transaction_idrequiredstring (ulid)Transaction ID
collection_idrequiredstring (ulid)Collection ID
callback_urlstring (uri)The URL which is used to send the result of the job.
Response 201application/json
5 fields

Created.

FieldTypeDescription
ruleset_namerequiredstringRuleset nameExample Some Ruleset
inputrequiredobjectData for the processing
data_objectsobject[]The array of data objects that need to be processed
datarequiredobjectThe data in staircase v2 format
collectionsobject[]The array of collection IDs that need to be processed
transaction_idrequiredstring (ulid)Transaction ID
collection_idrequiredstring (ulid)Collection ID
callback_urlstring (uri)The URL which is used to send the result of the job.
job_idrequiredstring (ulid)Identifier of the job
job_statusrequiredstringThe status of the jobSTARTED
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400422

GET /engine/data/jobs/{job_id}

Get Ruleset Invocation Status

getRulesetInvocationStatus

Returns the status of invoking Ruleset associated with the input collection(s) and output collection.

Response
application/json

Created.

{
  "job_id": "01FM2G606MNKG8YKD62EB64DDR",
  "job_status": "COMPLETED",
  "ruleset_name": "test4",
  "callback_url": "https://webhook.site/efc96f90-7e76-41bc-986f-5bcfaf1df8e3",
  "input": {
    "data_objects": [
      {
        "data": {
          "loans": [
            {
              "@id": "01FKYN27FFCBT3GHGNGWQ9S6CK",
              "@type": "loan",
              "with_insurance": [
                "01FKYN27FHSK0MFKHD9WXC819J"
              ],
              "with_loan_terms": [
                "01FKYN27FH8P2WS39Z5KSV7CEB"
              ],
              "with_payment": [
                "01FKYN27FJN6M8MMFMH4PDSG5E"
              ]
            }
          ],
          "insurance": [
            {
              "@id": "01FKYN27FHSK0MFKHD9WXC819J",
              "@type": "mortgage_insurance",
              "has_insurance_escrowed_indicator": {
                "has_value": "true"
              }
            }
          ],
          "loan_terms": [
            {
              "@id": "01FKYN27FH8P2WS39Z5KSV7CEB",
              "@type": "loan_terms",
              "has_hazard_insurance_escrow_required_indicator": {
                "has_value": "true"
              },
              "has_initial_principal_and_interest_payment_amount": {
                "has_value": 91.5
              },
              "has_loan_amortization_type": {
                "has_value": null
              },
              "has_prepaid_taxes_months_count": {
                "has_value": "7"
              },
              "has_tax_escrow_required_indicator": {
                "has_value": "true"
              }
            }
          ],
          "payments": [
            {
              "@id": "01FKYN27FJN6M8MMFMH4PDSG5E",
              "@type": "loan_payment",
              "has_late_charge_rate_percent": {
                "has_value": "5",
                "has_data_extraction_confidence_score": 95
              }
            }
          ],
          "documents": [
            {
              "@id": "01FKYN27FT44KKTAEC58S6Y6FY",
              "@type": "closing_disclosure",
              "has_document_date": {
                "has_value": "2021-01-29"
              },
              "has_document_misclassified_indicator": {
                "has_value": "false"
              }
            }
          ],
          "mortgage_products": [
            {
              "@id": "01FKYN27FX3A94JY49JYCW7RG0",
              "@type": "ide"
            }
          ]
        }
      }
    ],
    "collections": [
      {
        "collection_id": "01FM1Z95YK35V2V5MYBV52V1H0",
        "transaction_id": "01FM1Z7CAEHMA21C0GX78HGGSW"
      }
    ]
  },
  "output": {
    "data": {
      "assets": [
        {
          "@id": "01FFSP6DRCFJEHQK8ZH38HAH6X",
          "@type": "savings_account",
          "owned_by": [
            "01FFSP6DRCYYGGY9AER4H7GZXZ"
          ]
        },
        {
          "@id": "01FFSP6DRCFJEHQK8ZH38HAH6Z",
          "@type": "savings_account",
          "owned_by": [
            "01FFSP6DRCYYGGY9AER4H7GZXY",
            "01FFSP6DRCYYGGY9AER4H7GZXX"
          ]
        },
        {
          "@id": "01FFSP6DRCFJEHQK8ZH38HAH6Y",
          "@type": "savings_account",
          "owned_by": [
            "01FFSP6DRCYYGGY9AER4H7GZXY - 01FFSP6DRCYYGGY9AER4H7GZXZ"
          ]
        }
      ],
      "people": [
        {
          "@id": "01FFSP6DRCYYGGY9AER4H7GZXY",
          "@type": "borrower",
          "has_first_name": {
            "has_value": "John"
          },
          "has_last_name": {
            "has_value": "Snow"
          },
          "owns_asset": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Z",
            "01FFSP6DRCFJEHQK8ZH38HAH6Y"
          ]
        },
        {
          "@id": "01FFSP6DRCYYGGY9AER4H7GZXZ",
          "@type": "borrower",
          "has_first_name": {
            "has_value": "Jane"
          },
          "has_last_name": {
            "has_value": "Snow"
          },
          "owns_asset": [
            "01FFSP6DRCFJEHQK8ZH38HAH6X",
            "01FFSP6DRCFJEHQK8ZH38HAH6Y"
          ]
        },
        {
          "@id": "01FFSP6DRCYYGGY9AER4H7GZXX",
          "@type": "borrower",
          "has_first_name": {
            "has_value": "Jack"
          },
          "has_last_name": {
            "has_value": "Snow"
          },
          "owns_asset": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Z"
          ]
        }
      ],
      "relationships": [
        {
          "@type": "relationship",
          "link_from": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Z"
          ],
          "link_to": [
            "01FFSP6DRCYYGGY9AER4H7GZXY"
          ],
          "relationship_link": "ASSET_ROLE"
        },
        {
          "@type": "relationship",
          "link_from": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Y"
          ],
          "link_to": [
            "01FFSP6DRCYYGGY9AER4H7GZXY"
          ],
          "relationship_link": "ASSET_ROLE"
        },
        {
          "@type": "relationship",
          "link_from": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Z"
          ],
          "link_to": [
            "01FFSP6DRCYYGGY9AER4H7GZXX"
          ],
          "relationship_link": "ASSET_ROLE"
        },
        {
          "@type": "relationship",
          "link_from": [
            "01FFSP6DRCFJEHQK8ZH38HAH6Y"
          ],
          "link_to": [
            "01FFSP6DRCYYGGY9AER4H7GZXZ"
          ],
          "relationship_link": "ASSET_ROLE"
        },
        {
          "@type": "relationship",
          "link_from": [
            "01FFSP6DRCFJEHQK8ZH38HAH6X"
          ],
          "link_to": [
            "01FFSP6DRCYYGGY9AER4H7GZXZ"
          ],
          "relationship_link": "ASSET_ROLE"
        }
      ]
    }
  }
}
Parameters
1
ParameterTypeExampleDescription
job_id required string path 01FJC4JGKFX3VYB0EZ75JNY4J6 Identifier of the data processing job.
Response 200application/json
8 fields

Created.

FieldTypeDescription
job_idrequiredstring (ulid)Identifier of the job
job_statusrequiredstringThe status of the jobCOMPLETEDFAILEDIN_PROGRESS
failure_reasonstringThe reason of a failing for jobs with status FAILED
ruleset_namerequiredstringRuleset nameExample Some Ruleset
transaction_idrequiredstring (ulid)Transaction ID
inputrequiredobjectData for the processing
data_objectsobject[]The array of data objects that need to be processed
datarequiredobjectThe data in staircase v2 format
collectionsobject[]The array of collection IDs that need to be processed
transaction_idrequiredstring (ulid)Transaction ID
collection_idrequiredstring (ulid)Collection ID
callback_urlstring (uri)The URL which is used to send the result of the job
outputrequiredobjectThe data from rules applying
dataobjectRaw result data
metadataobjectMetadata about output data
statusstringStatus of the data validityHAS_VALIDATION_ERRORS
status_messagestringStatus description
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

GET /send-envelop

Get Ruleset Invocation Status

getRulesetInvocationStatus

Returns the status of invoking Ruleset associated with the input collection(s) and output collection.

Response
application/json

Created.

{
  "job_id": "01FM2G606MNKG8YKD62EB64DDR"
}
Parameters
1
ParameterTypeExampleDescription
job_id required string path 01FJC4JGKFX3VYB0EZ75JNY4J6 Identifier of the data processing job.
Response 200application/json
1 fields

Created.

FieldTypeDescription
job_idrequiredstring (ulid)Identifier of the job

Rulesets

GET /rulesets

Get Rulesets

getRulesets

Get Rulesets returns a list of all the Rulesets.

Response
application/json

OK.

{
  "count": 2,
  "rulesets": [
    {
      "name": "selective_merge",
      "description": "The ruleset for smart selecting data.",
      "operation": "SELECTIVE_DATA_MERGE"
    },
    {
      "name": "aus_relationships",
      "description": "The ruleset for setting relationships between entities in v2 to the separated object to be able to map it to v0.",
      "global_rdf_prefixes": [
        {
          "prefix": "rdf",
          "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        },
        {
          "prefix": "",
          "IRI": "https://www.staircase.co/ontology/"
        },
        {
          "prefix": "reserved",
          "IRI": "https://www.staircase.co/reserved/"
        }
      ],
      "operation": "DATA_INFERRING"
    }
  ]
}
Response 200application/json
2 fields

OK.

FieldTypeDescription
countrequiredintegerThe number of returned rulesets
rulesetsrequiredobject[]Rulesets list
rulesetobjectRuleset.
namerequiredstringRuleset nameExample Some Ruleset
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationrequiredstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
_linksobjectLinks to endpoints related to the ruleset
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
GET /rulesets/{ruleset_name}

Get Ruleset

getRuleset

Get Ruleset returns the Ruleset information.

Response
application/json

OK.

{
  "name": "selective_merge",
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Parameters
1
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
Response 200application/json
2 fields

OK.

FieldTypeDescription
rulesetobjectRuleset.
namerequiredstringRuleset nameExample Some Ruleset
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationrequiredstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
_linksobjectLinks to endpoints related to the ruleset
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

POST /rulesets

Create Ruleset

createRuleset

Creates Ruleset enable creation of Ruleset with the below attributes:

  • name: Name of the Ruleset.
  • description: Description of the Ruleset.
  • operation: Type of the operation that will be executed when Invoking the Ruleset, supported operations:
  • SELECTIVE_DATA_MERGE: merge collections in a new collection.
  • Input: Staircase Collection(s).
  • Process: Create new collection by running the ruleset on the input collections.
  • Output: A new collection generated from running the ruleset.
  • DATA_INFERRING: modify existing collection.
  • Input: Staircase Collection.
  • Process: Modify the collection by running the Ruleset.
  • Output: Modified collection.
Request
application/json
{
  "name": "selective_merge",
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Response
application/json

Created.

{
  "name": "selective_merge",
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Request bodyapplication/json
4 fields
FieldTypeDescription
namerequiredstringRuleset nameExample Some Ruleset
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationrequiredstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
Response 201application/json
4 fields

Created.

FieldTypeDescription
namerequiredstringRuleset nameExample Some Ruleset
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationrequiredstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 409application/json
1 fields

Resource already exists.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

PATCH /rulesets/{ruleset_name}

Update Ruleset

updateRuleset

Update Ruleset updates specific Ruleset, method shall update:

  • Description;
  • Operation;
  • Global RDF Prefixes.
Request
application/json
{
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Response
application/json

OK.

{
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Parameters
1
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
Request bodyapplication/json
3 fields
FieldTypeDescription
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
Response 200application/json
3 fields

OK.

FieldTypeDescription
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

DELETE /rulesets/{ruleset_name}

Delete Ruleset

deleteRuleset

Delete Ruleset deletes a specific Ruleset.

Response
application/json

OK.

{
  "name": "selective_merge",
  "description": "The ruleset for smart selecting data.",
  "operation": "SELECTIVE_DATA_MERGE",
  "global_rdf_prefixes": [
    {
      "prefix": "rdf",
      "IRI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    },
    {
      "prefix": "",
      "IRI": "https://www.staircase.co/ontology/"
    },
    {
      "prefix": "reserved",
      "IRI": "https://www.staircase.co/reserved/"
    }
  ]
}
Parameters
1
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
Response 200application/json
4 fields

OK.

FieldTypeDescription
namerequiredstringRuleset nameExample Some Ruleset
descriptionstringRuleset descriptionExample This ruleset can be used to select data from different collections.
operationrequiredstringThe purpose of the ruleset usageDATA_INFERRINGSELECTIVE_DATA_MERGE
global_rdf_prefixesobject[]Array of RDF prefixes
prefixstringPrefix that can be used in rules definitions
IRIstringIRI that will be used instead of prefix in rules definitions
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

Rules

GET /rulesets/{ruleset_name}/rules

Get Rules

getRules

Get Rules Return all the rules associated with a Ruleset. If Rules count > 200, response body will contain pagination link(s).

Response
application/json

OK.

{
  "count": 2,
  "rules": [
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :documents ?document .\n    ?document ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MIN(?document_date_value) as ?earliest_date_value)\n        WHERE\n        {\n            ?document :has_document_date / :has_value ?document_date_value .\n        }\n    }\n    ?document :has_document_date / :has_value ?earliest_date_value .\n    ?document ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    },
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :loan_terms ?loan_term .\n    ?loan_term ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MAX(?payment_amount_value) as ?max_payment_amount_value)\n        WHERE\n        {\n            ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?payment_amount_value .\n        }\n    }\n    ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?max_payment_amount_value .\n    ?loan_term ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    }
  ]
}
Parameters
3
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
sort string query asc Sorting direction
after_id string query a0533c96-937e-42cg-83b8-b63efe3cac8a Pagination marker. ID of the last rule from previous response.
Response 200application/json
3 fields

OK.

FieldTypeDescription
countrequiredintegerThe number of returned rules
_linksrequiredobjectPagination links
nextstringNext page
previousstringPrevious page
rulesrequiredarrayRules list
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

GET /rulesets/{ruleset_name}/rules/{rule_id}

Get Rule

getRule

Get Rule returns a specific Rule by ID and associated Ruleset name.

Response
application/json

OK.

{
  "definition": {
    "raw_sparql": "CONSTRUCT\n{\n    reserved:root :documents ?document .\n    ?document ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MIN(?document_date_value) as ?earliest_date_value)\n        WHERE\n        {\n            ?document :has_document_date / :has_value ?document_date_value .\n        }\n    }\n    ?document :has_document_date / :has_value ?earliest_date_value .\n    ?document ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
  }
}
Parameters
2
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
rule_id required string path my_rule Rule id (name)
Response 200application/json
4 fields

OK.

FieldTypeDescription
idstringRule ID. Can be specified to identify it later. Otherwise, it will be set automatically.
descriptionstringDescription of rule.
local_rdf_prefixesobject[]Array of RDF prefixes.
prefixrequiredstringPrefix that can be used in rule definition.
IRIrequiredstringIRI that will be used instead of prefix in rule definition.
definitionrequiredobjectDefinition of rule.
raw_sparqlrequiredstringRaw SPARQL query (or insert) expression.
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

POST /rulesets/{ruleset_name}/rules

Create Or Update Rules

createOrUpdateRules

Create or Update Rules

Create Or Update Rules enables creating or updating multiple Rules using the same request. The endpoint shall check the pre-existence of Rule by ID. If the id doesn't exist, the rule will be created.

Request
application/json
{
  "rules": [
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :documents ?document .\n    ?document ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MIN(?document_date_value) as ?earliest_date_value)\n        WHERE\n        {\n            ?document :has_document_date / :has_value ?document_date_value .\n        }\n    }\n    ?document :has_document_date / :has_value ?earliest_date_value .\n    ?document ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    },
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :loan_terms ?loan_term .\n    ?loan_term ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MAX(?payment_amount_value) as ?max_payment_amount_value)\n        WHERE\n        {\n            ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?payment_amount_value .\n        }\n    }\n    ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?max_payment_amount_value .\n    ?loan_term ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    }
  ]
}
Response
application/json

OK. Created or updated.

{
  "rules": [
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :documents ?document .\n    ?document ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MIN(?document_date_value) as ?earliest_date_value)\n        WHERE\n        {\n            ?document :has_document_date / :has_value ?document_date_value .\n        }\n    }\n    ?document :has_document_date / :has_value ?earliest_date_value .\n    ?document ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    },
    {
      "definition": {
        "raw_sparql": "CONSTRUCT\n{\n    reserved:root :loan_terms ?loan_term .\n    ?loan_term ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MAX(?payment_amount_value) as ?max_payment_amount_value)\n        WHERE\n        {\n            ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?payment_amount_value .\n        }\n    }\n    ?loan_term :has_initial_principal_and_interest_payment_amount / :has_value ?max_payment_amount_value .\n    ?loan_term ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
      }
    }
  ]
}
Parameters
1
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
Request bodyapplication/json
1 fields
FieldTypeDescription
rulesrequiredarrayRules list
Response 200application/json
1 fields

OK. Created or updated.

FieldTypeDescription
rulesrequiredarrayRules list
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Response 409application/json
1 fields

Resource already exists.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

DELETE /rulesets/{ruleset_name}/rules/{rule_id}

Delete Rule

deleteRule

Delete Rules

Delete Rule deletes a specific Rule using Rule ID and Ruleset name.

Response
application/json

Deleted.

{
  "definition": {
    "raw_sparql": "CONSTRUCT\n{\n    reserved:root :documents ?document .\n    ?document ?p ?o .\n    ?o ?po ?oo .\n}\nWHERE\n{\n    {\n        SELECT (MIN(?document_date_value) as ?earliest_date_value)\n        WHERE\n        {\n            ?document :has_document_date / :has_value ?document_date_value .\n        }\n    }\n    ?document :has_document_date / :has_value ?earliest_date_value .\n    ?document ?p ?o .\n    OPTIONAL { ?o ?po ?oo . }\n}\n"
  }
}
Parameters
2
ParameterTypeExampleDescription
ruleset_name required string path my_ruleset Ruleset name
rule_id required string path my_rule Rule id (name)
Response 200application/json
4 fields

Deleted.

FieldTypeDescription
idstringRule ID. Can be specified to identify it later. Otherwise, it will be set automatically.
descriptionstringDescription of rule.
local_rdf_prefixesobject[]Array of RDF prefixes.
prefixrequiredstringPrefix that can be used in rule definition.
IRIrequiredstringIRI that will be used instead of prefix in rule definition.
definitionrequiredobjectDefinition of rule.
raw_sparqlrequiredstringRaw SPARQL query (or insert) expression.
Response 403application/json
1 fields

Forbidden.

FieldTypeDescription
messagerequiredstringMessage
Response 404application/json
1 fields

Resource is not found.

FieldTypeDescription
messagerequiredstringMessage
Other responses

400

Operations

POST /rule-engine

Create Rule Engine

post-rule-engine

Create Rule Engine creates views of products, risk factors and other business intelligence that have been evaluated by a set of rules affecting the decisioning process.

Request
application/json
{
  "transaction_id": "uhz6t54e-9d74-g17e-99ca-a36b30vdfd35",
  "collection_id": "hg62e49f-9d74-g17e-99ca-a36b30vdfd35",
  "partner_name": "PartnerName"
}
Response
application/json

Rule Engine request created successfully.

{
  "collection_id": "e4502ed2-8df8-4b8f-84bd-a1097e999a77",
  "message": "When ready, data will be available under the following collection_id. Use this new collection_id to get the execution status."
}
Parameters
1
ParameterTypeExampleDescription
x-api-key required string header xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Authorization key
Request bodyapplication/json
3 fields
FieldTypeDescription
transaction_idrequiredstringTransaction ID
collection_idrequiredstringCollection ID
partner_namerequiredstring
Response 200application/json
2 fields

Rule Engine request created successfully.

FieldTypeDescription
collection_idstringCollection ID
messagestringMessage

Errors

400403404409422

Type to search.