{
  "openapi": "3.0.1",
  "info": {
    "title": "TinCorrect API",
    "version": "v1"
  },
  "paths": {
    "/BulkTinRequest": {
      "post": {
        "tags": [
          "BulkTinRequest"
        ],
        "summary": "Submit a bulk check request (lightweight version for large datasets)\r\nUses blob storage to persist TIN pairs instead of direct database writes\r\nto avoid HTTP timeouts with large datasets (100k+ records)",
        "requestBody": {
          "description": "Bulk request data",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddBulkTinRequestSharedModel"
                  }
                ]
              }
            },
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddBulkTinRequestSharedModel"
                  }
                ]
              }
            },
            "text/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddBulkTinRequestSharedModel"
                  }
                ]
              }
            },
            "application/*+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddBulkTinRequestSharedModel"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bulk Request ID - used for retrieving results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "BulkTinRequest"
        ],
        "summary": "Get bulk request results",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Bulk Check Request ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "maskTins",
            "in": "query",
            "description": "If true results will include only the last 4 digits of each TIN",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bulk check result object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkTinRequestResultSharedModel"
                }
              }
            }
          }
        }
      }
    },
    "/BulkTinRequest/{id}": {
      "get": {
        "tags": [
          "BulkTinRequest"
        ],
        "summary": "Get bulk request results",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Bulk Check Request ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "maskTins",
            "in": "query",
            "description": "If true results will include only the last 4 digits of each TIN",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bulk check result object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkTinRequestResultSharedModel"
                }
              }
            }
          }
        }
      }
    },
    "/BulkTinRequestResultFile/{id}": {
      "get": {
        "tags": [
          "BulkTinRequest"
        ],
        "summary": "Get bulk request results as a file",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Bulk Check Request ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "userFriendlyResult",
            "in": "query",
            "description": "If true result file will be in a user friendly format with result descriptions instead of IDs",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "maskTins",
            "in": "query",
            "description": "If true results will include only the last 4 digits of each TIN",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a text file containing the result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    },
    "/SearchCredits": {
      "get": {
        "tags": [
          "SearchCredits"
        ],
        "summary": "Get number of search credits available",
        "responses": {
          "200": {
            "description": "Number of available search credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        }
      }
    },
    "/Status": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "Get the site status",
        "responses": {
          "200": {
            "description": "Status result indicating if the service is down and when the downtime started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            }
          }
        }
      }
    },
    "/TinRequest/{id}": {
      "get": {
        "tags": [
          "TinRequest"
        ],
        "summary": "Retrieve single TIN check results. **NOTE: We recommend polling no more than once every 2 seconds. Polling more often can result in rate limiting.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Single Check Request ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Single check result object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TinRequestResultSharedModel"
                }
              }
            }
          }
        }
      }
    },
    "/TinRequest": {
      "post": {
        "tags": [
          "TinRequest"
        ],
        "summary": "Request a single TIN check.",
        "requestBody": {
          "description": "",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddTinRequestSharedModel"
                  }
                ]
              }
            },
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddTinRequestSharedModel"
                  }
                ]
              }
            },
            "text/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddTinRequestSharedModel"
                  }
                ]
              }
            },
            "application/*+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AddTinRequestSharedModel"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request ID - used for retrieving request results in GET TinRequest",
            "content": {
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        }
      }
    },
    "/Token": {
      "post": {
        "tags": [
          "Token"
        ],
        "summary": "Uses basic auth. Will accept JSON encoded username and password  { username:'', password:''} or form url encoded (username=usernamevalue&password=passwordvalue)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "example": "exampleUser"
                  },
                  "password": {
                    "type": "string",
                    "example": "examplePassword"
                  }
                }
              },
              "examples": {
                "JsonExample": {
                  "summary": "JSON Example",
                  "value": {
                    "username": "exampleUser",
                    "password": "examplePassword"
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "example": "exampleUser"
                  },
                  "password": {
                    "type": "string",
                    "example": "examplePassword"
                  }
                }
              },
              "examples": {
                "FormUrlEncodedExample": {
                  "summary": "Form URL Encoded Example",
                  "value": "username=exampleUser&password=examplePassword"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Use the access_token in the Request.Header of subsequent calls for Bearer Token authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AddBulkTinRequestSharedModel": {
        "type": "object",
        "properties": {
          "tinPairs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkRequestTinPairSharedModel"
            },
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AddTinRequestSharedModel": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "tin": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "BulkRequestTinPairResultSharedModel": {
        "type": "object",
        "properties": {
          "tinType": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "tin": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "accountNumber": {
            "type": "string",
            "nullable": true
          },
          "irsResultId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "resultDescription": {
            "type": "string",
            "nullable": true
          },
          "additionalResults": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BulkRequestTinPairSharedModel": {
        "type": "object",
        "properties": {
          "tinType": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "tin": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "accountNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BulkTinRequestResultSharedModel": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "tinPairResults": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkRequestTinPairResultSharedModel"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "StatusResult": {
        "type": "object",
        "properties": {
          "isDown": {
            "type": "boolean"
          },
          "downStartedOn": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "TinRequestResultSharedModel": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "integer",
            "format": "int32"
          },
          "tin": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "irsResultId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "resultDescription": {
            "type": "string",
            "nullable": true
          },
          "resultCategory": {
            "type": "string",
            "nullable": true
          },
          "requestDate": {
            "type": "string",
            "format": "date-time"
          },
          "additionalResults": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "nullable": true
          },
          "token_type": {
            "type": "string",
            "nullable": true
          },
          "expires_in": {
            "type": "string",
            "nullable": true
          },
          "userName": {
            "type": "string",
            "nullable": true
          },
          "issued": {
            "type": "string",
            "nullable": true
          },
          "expires": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "This is what is returned when login is successful."
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme.\r\n                      Enter 'Bearer' [space] and then your token in the text input below.\r\n                      Example: 'Bearer 12345abcdef'",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}