# Get the content of a credit profile report file by report ID. Returns the report as a base64-encoded string.

## Get Credit Profile Report

Downloads the full content of a specific credit profile report as a base64-encoded string. Use the `reportId` values returned by `GET /api/v1/merchant/creditProfile` to identify which report to retrieve.

### Endpoint

`GET /api/v1/merchant/creditProfile/report`

### Authentication

Basic HTTP Authentication required. Encode `username:password` in Base64 and pass in the Authorization header:

```
Authorization: Basic {base64(username:password)}
```

### When to use

Use this endpoint after calling `GET /creditProfile` to get the list of available reports. Once you have a `reportId` with status `Completed`, call this endpoint to download the actual report content for display, storage, or further processing. Decode the base64 `data` field to get the raw file (PDF or XML).

### Query Parameters

| Parameter | Type            | Required | Description                                                         |
| --------- | --------------- | -------- | ------------------------------------------------------------------- |
| id        | integer (int32) | Yes      | Merchant profile ID                                                 |
| reportId  | integer (int32) | Yes      | Report ID from the `reports` array returned by `GET /creditProfile` |

### Response

**200 OK**

| Field           | Type    | Description                                                  |
| --------------- | ------- | ------------------------------------------------------------ |
| data.reportId   | string  | Report identifier                                            |
| data.fileName   | string  | Original file name of the report                             |
| data.outputType | string  | Report format: `PDF`, `XML`                                  |
| data.status     | string  | Report status: `Completed`, `Pending`, `Failed`              |
| data.data       | string  | Base64-encoded report content — decode to get raw file bytes |
| requestId       | integer | Unique request identifier for tracing                        |
| success         | boolean | `true` if request succeeded                                  |
| error           | string  | Error message if `success` is `false`                        |

```json
{
  "data": {
    "reportId": "rpt-8f3a2c1d",
    "fileName": "experian_credit_report_161787.pdf",
    "outputType": "PDF",
    "status": "Completed",
    "data": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw..."
  },
  "requestId": 4187891,
  "success": true,
  "error": null
}
```

### Error Codes

| Code | When it happens                           |
| ---- | ----------------------------------------- |
| 400  | `id` or `reportId` missing or invalid     |
| 401  | Invalid or missing Basic Auth credentials |
| 403  | User does not have Underwriting access    |
| 404  | Merchant or report not found              |
| 500  | Internal server error                     |

### Common Mistakes

* Passing the wrong `reportId` type — the query parameter expects `integer` but `reportId` in the reports list is returned as `string`. Parse it to int before passing.
* Trying to download a report with status `Pending` — wait until status is `Completed` before calling this endpoint.
* Not decoding the base64 — the `data` field is base64-encoded. Use `atob()` (JS), `base64.b64decode()` (Python), or `[Convert]::FromBase64String()` (PowerShell) to get the raw file.

### Related Endpoints

* [`GET /api/v1/merchant/creditProfile`](./creditprofile_getcreditprofile.md) — get list of available reportIds
* [`POST /api/v1/merchant/creditProfile/softPull`](./creditprofile_triggersoftpull.md) — trigger a new report run

### Example

```bash
curl -X GET "https://hq.staging.netevia.dev/api/v1/merchant/creditProfile/report?id=161787&reportId=42" \
  -H "Authorization: Basic $(echo -n 'username:password' | base64)"
```

**Decode the response in PowerShell:**

```powershell
$response = Invoke-RestMethod -Uri "https://hq.staging.netevia.dev/api/v1/merchant/creditProfile/report?id=161787&reportId=42" -Headers $headers
$bytes = [Convert]::FromBase64String($response.data.data)
[System.IO.File]::WriteAllBytes("C:\reports\credit_report.pdf", $bytes)
```

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "v1",
    "title": "Netevia HQ | API Documentation",
    "description": "Netevia HQ | API Documentation"
  },
  "paths": {
    "/api/v1/merchant/creditProfile/report": {
      "get": {
        "tags": [
          "Underwriting"
        ],
        "summary": "Get the content of a credit profile report file by report ID. Returns the report as a base64-encoded string.",
        "operationId": "CreditProfile_GetCreditProfileReport",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "Merchant profile ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reportId",
            "in": "query",
            "description": "Report ID from the reports array returned by GET creditProfile",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResult1_CreditProfileReportFileResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResult1_CreditProfileReportFileResponse"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResult1_CreditProfileReportFileResponse"
                }
              },
              "text/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResult1_CreditProfileReportFileResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "Basic": []
    }
  ],
  "servers": [
    {
      "url": "https://hq.staging.netevia.dev"
    }
  ],
  "components": {
    "securitySchemes": {
      "Basic": {
        "type": "http",
        "description": "Basic HTTP Authentication",
        "scheme": "basic"
      }
    },
    "schemas": {
      "ValidationError": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "ApiResult1_CreditProfileReportFileResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CreditProfileReportFileResponse"
          },
          "requestId": {
            "format": "int32",
            "type": "integer"
          },
          "success": {
            "type": "boolean"
          },
          "error": {
            "type": "string"
          },
          "validationErrors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        }
      },
      "CreditProfileReportFileResponse": {
        "type": "object",
        "properties": {
          "reportId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "outputType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "data": {
            "type": "string"
          }
        }
      }
    }
  }
}
```