## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://developer.mindbridge.ai/llms.txt)

Use this file to discover all available pages before exploring further.

POST

/v1

analyses

### Create Analysis

**cURL**

```bash
curl --request POST \
  --url https://{tenant}.mindbridge.ai/api/v1/analyses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "engagementId": "<string>",
  "analysisTypeId": "<string>",
  "name": "<string>",
  "analysisPeriods": [
    {
      "startDate": "2023-12-25",
      "endDate": "2023-12-25",
      "interimAsAtDate": "2023-12-25"
    }
  ],
  "currencyCode": "<string>",
  "interim": true,
  "periodic": true,
  "referenceId": "<string>"
}
' 
```

```python
import requests

url = "https://{tenant}.mindbridge.ai/api/v1/analyses"

payload = {
    "engagementId": "<string>",
    "analysisTypeId": "<string>",
    "name": "<string>",
    "analysisPeriods": [
        {
            "startDate": "2023-12-25",
            "endDate": "2023-12-25",
            "interimAsAtDate": "2023-12-25"
        }
    ],
    "currencyCode": "<string>",
    "interim": True,
    "periodic": True,
    "referenceId": "<string>"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

```javascript
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    engagementId: '<string>',
    analysisTypeId: '<string>',
    name: '<string>',
    analysisPeriods: [
      {startDate: '2023-12-25', endDate: '2023-12-25', interimAsAtDate: '2023-12-25'}
    ],
    currencyCode: '<string>',
    interim: true,
    periodic: true,
    referenceId: '<string>'
  })
};

fetch('https://{tenant}.mindbridge.ai/api/v1/analyses', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://{tenant}.mindbridge.ai/api/v1/analyses",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'engagementId' => '<string>',
    'analysisTypeId' => '<string>',
    'name' => '<string>',
    'analysisPeriods' => [
        [
            'startDate' => '2023-12-25',
            'endDate' => '2023-12-25',
            'interimAsAtDate' => '2023-12-25'
        ]
    ],
    'currencyCode' => '<string>',
    'interim' => true,
    'periodic' => true,
    'referenceId' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://{tenant}.mindbridge.ai/api/v1/analyses"

payload := strings.NewReader("{\n  \"engagementId\": \"<string>\",\n  \"analysisTypeId\": \"<string>\",\n  \"name\": \"<string>\",\n  \"analysisPeriods\": [\n    {\n      \"startDate\": \"2023-12-25\",\n      \"endDate\": \"2023-12-25\",\n      \"interimAsAtDate\": \"2023-12-25\"\n    }\n  ],\n  \"currencyCode\": \"<string>\",\n  \"interim\": true,\n  \"periodic\": true,\n  \"referenceId\": \"<string>\"}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

```java
HttpResponse<String> response = Unirest.post("https://{tenant}.mindbridge.ai/api/v1/analyses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"engagementId\": \"<string>\",\n  \"analysisTypeId\": \"<string>\",\n  \"name\": \"<string>\",\n  \"analysisPeriods\": [\n    {\n      \"startDate\": \"2023-12-25\",\n      \"endDate\": \"2023-12-25\",\n      \"interimAsAtDate\": \"2023-12-25\"\n    }\n  ],\n  \"currencyCode\": \"<string>\",\n  \"interim\": true,\n  \"periodic\": true,\n  \"referenceId\": \"<string>\"}")
  .asString();
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://{tenant}.mindbridge.ai/api/v1/analyses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"engagementId\": \"<string>\",\n  \"analysisTypeId\": \"<string>\",\n  \"name\": \"<string>\",\n  \"analysisPeriods\": [\n    {\n      \"startDate\": \"2023-12-25\",\n      \"endDate\": \"2023-12-25\",\n      \"interimAsAtDate\": \"2023-12-25\"\n    }\n  ],\n  \"currencyCode\": \"<string>\",\n  \"interim\": true,\n  \"periodic\": true,\n  \"referenceId\": \"<string>\"}"

response = http.request(request)
puts response.read_body
```

### 201 Response
```json
{
  "id": "<string>",
  "version": 123,
  "creationDate": "2023-11-07T05:31:56Z",
  "lastModifiedDate": "2023-11-07T05:31:56Z",
  "createdUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "lastModifiedUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "engagementId": "<string>",
  "analysisTypeId": "<string>",
  "name": "<string>",
  "interim": true,
  "archived": true,
  "converted": true,
  "periodic": true,
  "importantColumns": [
    {
      "columnName": "<string>",
      "field": "<string>"
    }
  ],
  "analysisPeriods": [
    {
      "startDate": "2023-12-25",
      "endDate": "2023-12-25",
      "id": "<string>",
      "interimAsAtDate": "2023-12-25"
    }
  ],
  "analysisPeriodGaps": [
    {
      "analysisPeriodId": "<string>",
      "previousAnalysisPeriodId": "<string>",
      "days": 123
    }
  ],
  "currencyCode": "<string>",
  "latestAnalysisResultId": "<string>",
  "referenceId": "<string>",
  "reportingPeriodConfigurationId": "<string>",
  "accountingPeriod": {
    "fiscalStartMonth": 123,
    "fiscalStartDay": 123
  }
}
```

### Authorizations
#### Authorization
- Type: string 
- Location: header 
- Required: Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

### Body
#### Fields
- `engagementId`: string - required, Identifies the associated engagement.
- `analysisTypeId`: string - required, Identifies the type of analysis.
- `name`: string - required, The name of the analysis (maximum length: 80).
- `analysisPeriods`: array of objects - required, Details about the specific analysis periods under audit (minimum length: 1).
- `currencyCode`: string - required, The currency to be displayed across the analysis results.
- `interim`: boolean - indicates whether or not the analysis is using an interim time frame.
- `periodic`: boolean - indicates whether or not the analysis is using a periodic time frame.
- `referenceId`: string - optional, A reference ID to identify the analysis (maximum length: 256).

### Response
#### 201 - Created
- **id**: string - The unique object identifier.
- **version**: integer - Indicates the data integrity version.
- **creationDate**: string - The date that the object was originally created.
- **lastModifiedDate**: string - The date that the object was last updated.
- **createdUserInfo**: object - Details about the user who created the object.
- **lastModifiedUserInfo**: object - Details about the user who last modified the object.
- **engagementId**: string - Identifies the associated engagement.
- **analysisTypeId**: string - Identifies the type of analysis.
- **name**: string - The name of the analysis.
- **interim**: boolean - Indicates whether or not the analysis is using an interim time frame.
- **archived**: boolean - Indicates whether or not the analysis has been archived.
- **converted**: boolean - Indicates whether or not an interim analysis has been converted to a full analysis.
- **periodic**: boolean - Indicates whether or not the analysis is using a periodic time frame.
- **importantColumns**: array of objects - Additional data columns.
- **analysisPeriods**: array of objects - Details about the specific analysis periods under audit.
- **analysisPeriodGaps**: array of objects - Details about the gap in time between two analysis periods.
- **currencyCode**: string - The currency to be displayed across the analysis results.
- **latestAnalysisResultId**: string.
- **referenceId**: string - A reference ID to identify the analysis.
- **reportingPeriodConfigurationId**: string - Identifies the reporting period configuration.
- **accountingPeriod**: object - Details about the accounting period used in this analysis.
