# Results and Artifacts

Results are how your system retrieves processed data from Tediware. You first learn that processing has completed through a notification that carries a `resultId`: a webhook call if the partner uses webhooks, or a feed entry if it is poll-based. Your system then uses that ID to fetch the result and download the artifacts (the actual EDI or JSON files). You can also list results by trace GUID to see every step in a processing run.

## List Results

```
GET /platform/results
```

Returns a paginated list of results for your organization, ordered by most recent first.

Query parameters:

- `trace` -- filter by trace GUID to see all results from a single processing run
- `node` -- filter by node ID to see results from a specific node
- `limit` -- number of results per page (default 50, maximum 100)
- `cursor` -- pagination cursor from a previous response

The response includes a `results` array and a `pagination` object:

```json
{
  "results": [
    {
      "id": "4c2021f8-8310-4628-80f9-b578d4d68e11",
      "traceGuid": "5ab72145-4a4b-40f6-95de-e2579f163f79",
      "createdAt": "2026-03-30T14:22:33.260Z",
      "updatedAt": "2026-03-30T14:22:33.260Z",
      "nodeName": "Mapping",
      "detail": {
        "direction": "outbound"
      }
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "MjAyNi0wMy0zMFQxNDoyMjozMy4yNjAwMDBafDRjMjAyMWY4..."
  }
}
```

Results use cursor-based pagination. When `hasMore` is `true`, pass the `nextCursor` value as the `cursor` parameter in your next request to retrieve the following page.

```bash
# First page
curl "https://tediware.com/platform/results?trace=5ab72145-4a4b-40f6-95de-e2579f163f79&limit=10" \
  -H "Authorization: Key your-api-key-here"

# Next page
curl "https://tediware.com/platform/results?trace=5ab72145-4a4b-40f6-95de-e2579f163f79&limit=10&cursor=MjAyNi0wMy0zMFQxNDoyMjozMy4yNjAwMDBafDRjMjAyMWY4..." \
  -H "Authorization: Key your-api-key-here"
```

## Get a Single Result

```
GET /platform/results/:id
```

Returns the full detail for a single result:

```json
{
  "id": "4c2021f8-8310-4628-80f9-b578d4d68e11",
  "traceGuid": "5ab72145-4a4b-40f6-95de-e2579f163f79",
  "createdAt": "2026-03-30T14:22:33.260Z",
  "updatedAt": "2026-03-30T14:22:33.260Z",
  "nodeName": "Implementation",
  "detail": {
    "direction": "outbound",
    "x12": {
      "sender": {
        "isa": { "qualifier": "ZZ", "id": "YOURID" }
      },
      "receiver": {
        "isa": { "qualifier": "ZZ", "id": "PARTNERID" }
      },
      "transaction": {
        "transactionSetIdentifier": "810",
        "controlNumber": 1043
      },
      "interchange": {
        "controlNumber": 1042
      },
      "functionalGroup": {
        "controlNumber": 1043
      }
    },
    "artifacts": [
      { "id": "1dc6a6fb-abcd-1234-ef56-789012345678", "usage": "input", "contentType": "application/json" },
      { "id": "b613c64c-dcba-4321-fe65-987654321098", "usage": "output", "contentType": "application/edi-x12" }
    ]
  }
}
```

The `detail` object contains:

- `direction` -- `"inbound"` or `"outbound"`
- `errorMessage` -- present when the processing step encountered an error
- `x12` -- EDI-specific metadata including sender/receiver identifiers, transaction set code, and control numbers
- `artifacts` -- references to the input and output files produced at this step. Each artifact has an `id`, a `usage` (`"input"` or `"output"`), and a `contentType`. The `contentType` is the file's MIME type and is the most direct way to identify which artifact you want: `"application/json"` for parsed/source JSON and `"application/edi-x12"` for EDI. For inbound processing the parsed JSON is the `"output"` artifact; for outbound it is the `"input"`. Older results created before content types were recorded may omit this field.

## Download an Artifact

```
GET /platform/artifacts/:id
```

Downloads the actual file content for an artifact. The response is the raw file with its original filename and content type -- not a JSON response.

Artifact IDs are found in the `detail.artifacts` array of a result response.

```bash
# Download an artifact and save to a file
curl "https://tediware.com/platform/artifacts/b613c64c-dcba-4321-fe65-987654321098" \
  -H "Authorization: Key your-api-key-here" \
  -o output.edi
```

Returns `404` if the artifact does not exist or its file is not available.
