# 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",
        "partner": { "key": "ACME_FOODS" }
      }
    }
  ],
  "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",
    "partner": { "key": "ACME_FOODS" },
    "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", "filename": "invoice-001.json" },
      { "id": "b613c64c-dcba-4321-fe65-987654321098", "usage": "output", "contentType": "application/edi-x12", "filename": "invoice-001.edi" }
    ],
    "transformations": ["mapping", "implementation validation + edi write"]
  }
}
```

The `detail` object contains:

- `direction` -- `"inbound"` or `"outbound"`
- `partner` -- the trading partner this result belongs to, as `{ "key": "..." }`. The `key` is the partner's stable identifier in Tediware
- `errorMessage` -- present when the processing step encountered an error
- `mappingFailed` -- `true` when an inbound mapping failed on this document, meaning the output is not guaranteed to be the canonical shape (see Inbound EDI). Absent when the mapping succeeded or no mapping is assigned.
- `mappingError` -- describes what went wrong, present alongside `mappingFailed`. An object with a `kind`, a `message`, and for validation failures an `errors` array. `kind` is `"expression"` when the transformation failed to run (the output is the untransformed translation) or `"validation"` when the transformation ran but its output did not match the canonical shape (the output is the mapped document, delivered as produced)
- `x12` -- EDI-specific metadata including sender/receiver identifiers, transaction set code, and control numbers
- `artifacts` -- references to the files produced at this step. Each artifact has an `id`, a `usage`, and a `contentType` (the file's MIME type: `"application/json"` for JSON, `"application/edi-x12"` for EDI; older results created before content types were recorded may omit it). The `usage` names the artifact's role in the flow. `"input"` is the document the flow received and `"output"` is the document it delivered: for inbound processing the input is the partner's EDI and the output is the delivered JSON, and for outbound the input is your JSON and the output is the generated EDI. Other `usage` values name intermediate documents kept alongside them; on a mapped inbound result, `"translation"` is the parsed JSON the mapping received. Select artifacts by `usage`, since more than one can share a `contentType`.
- `filename` -- on each artifact, the name the file was stored under. Present when the step that produced it recorded one. It is not always meaningful: when no name was supplied, Tediware generates one from a UUID, and artifacts written before filenames were recorded omit the field.
- `transformations` -- the processing steps that ran on this result, in order. Use it to diagnose what did or did not execute, for example whether an inbound mapping ran on a document. Step names are internal labels, ranging from identifiers like `edi_to_json` to phrases like `implementation validation + edi write`; they are not the node names shown in the Tediware UI, and their naming and granularity change as flows evolve and as Tediware changes internally. Treat this as diagnostic detail rather than a stable contract. Do not branch on its contents.
- `sftp` -- where the document came from or went, on results that moved over SFTP. Present in two shapes. A document Tediware fetched from a partner carries `filename`, `path`, `host`, `directory`, and `fetchedAt`; a document Tediware uploaded carries `filename`, `directory`, `host`, and `uploadedAt`, with no `path`. The `host` is your own SFTP connection. Absent on documents that arrived or left another way, such as AS2 or the API.

## 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.
