---
title: "POST /x12/partnerships/{partnershipId}/generate-edi"
method: POST
path: "/x12/partnerships/{partnershipId}/generate-edi"
---

# POST /x12/partnerships/{partnershipId}/generate-edi

`POST /x12/partnerships/{partnershipId}/generate-edi`

This endpoint generates and delivers fully-formed EDI files to your trading partners.

## Path parameters

- `partnershipId` string, required — A unique ID for this partnership within Stedi. You can find this ID on the [Trading partners](https://www.stedi.com/app/core/partnerships) page under **Partnership identifier**.

## Headers

- `Idempotency-Key` string — A unique string to identify this request to the server. The key can be up to 255 characters. You can safely retry requests with the same idempotency key within 24 hours of making the first request. This prevents sending duplicate data to your trading partners in case of network errors or other intermittent failures. [Learn more](https://www.stedi.com/docs/api-reference/index#idempotency-keys).

## Request body

- GenerateEdiRequestContent
  - `characterSet` 'Basic' | 'Extended' | 'ExtendedHipaa' — When generating EDI, the character set determines the set of characters allowed in the EDI message. Characters outside of the specified set (after applying any repairs specified in RepairOptions) will result in an error.
  - `repairOptions` RepairOptions — Options for repairing EDI data during generation to ensure it meets X12 requirements
    - `trimTrailingSpaces` boolean — Whether to trim trailing spaces from data elements
    - `uppercase` boolean — Whether to convert text to uppercase
    - `replaceConfusable` boolean — Whether to replace characters that are visually similar but technically different
    - `removeDiacritical` boolean — Whether to remove diacritical marks from characters
    - `replaceNonBasicCharacters` boolean — Whether to replace non-basic characters with their basic equivalents
    - `replaceStediCanonicalDelimitersConflicts` boolean — Whether to replace characters that conflict with Stedi canonical delimiters
    - `trimTrailingZeroes` boolean — Whether to trim trailing zeros from numeric data elements
  - `transactionGroups` TransactionGroup[], required — Contains one or more EDI functional groups, each containing the data for one or more EDI transactions. You can override the Application IDs (GS-02 and GS-03) for each group individually. The outbound transaction setting for each group must be configured to use the same connection. If you need to send transactions to different connections, you must call the endpoint multiple times.
    - `transactionSettingId` string, required — A unique ID outbound transaction setting Stedi should use to determine the correct guide for validation and generation. To find this ID, go to the partnership and use the **Transaction Setting ID** field for the outbound transaction setting.
    - `transactions` unknown[], required — This payload contains the transaction data. It must conform to the JSON Schema for the guide associated with each transaction setting (Guide JSON format).
      - unknown
    - `overrides` TransactionGroupOverrides — Customize the Application IDs for you or your trading partner.
      - `localApplicationId` string — Set the [GS-02](https://www.stedi.com/edi/x12/segment/GS#GS-02) element to a custom value. If not set, Stedi uses the Application ID for the local profile associated with the partnership.
      - `partnerApplicationId` string — Set the [GS-03](https://www.stedi.com/edi/x12/segment/GS#GS-03) element to a custom value. If not set, Stedi uses the Application ID for the partner profile associated with the partnership.
  - `filename` string — Set a custom name for the generated EDI file. Stedi overwrites files with the same name, so we recommend making the filename unique by including a timestamp or other identifier. If you do not specify a filename, Stedi autogenerates a unique name using an ID.
  - `overrides` InterchangeOverrides
    - `interchangeUsageIndicator` 'I' | 'T' | 'P' — Set [ISA-15](https://www.stedi.com/edi/x12/segment/ISA#ISA-15) to a different value. If not set, the default value is `P (Production Data)`.
    - `acknowledgmentRequestedCode` '0' | '1' | '2' | '3' — Set [ISA-14](https://www.stedi.com/edi/x12/segment/ISA#ISA-14) to a different value. If not set, the default value is `0 (No Interchange Acknowledgment Requested)`.
    - `interchangeControlVersionNumberCode` string — Set [ISA-12](https://www.stedi.com/edi/x12/segment/ISA#ISA-12) to a different value. This code indicates the version of the `ISA` header segments included in the EDI file. By default, Stedi sets `ISA-12` to to be the X12 release number of the guide associated with the transaction setting.
    - `delimiters` X12Delimiters
      - `element` string, required — The data element separator character.
      - `composite` string, required — The component element separator character.
      - `repetition` string, required — The repetition separator character.
      - `segment` string, required — The segment terminator character.
  - `interchangeUsageIndicatorOverride` 'I' | 'T' | 'P' — Set [ISA-15](https://www.stedi.com/edi/x12/segment/ISA#ISA-15) to a different value. If not set, the default value is `P (Production Data)`.
  - `interchangeAuthorization` X12InterchangeAuthorization — Set values for [ISA header](https://www.stedi.com/edi/x12/segment/ISA) elements (ISA-01 to ISA-04).
    - `authorizationInformationQualifier` '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' — Identifies the type of information in the Authorization Information (`ISA-01`). Default is `00 - No Authorization Information Present`.
    - `authorizationInformation` string — Information used for additional identification or authorization of the interchange sender or the data in the interchange (`ISA-02`). The type of information is set by the `authorizationInformationQualifier`.
    - `securityInformationQualifier` '00' | '01' — Identifies the type of information in the Security Information (ISA-03). Default is `00 - No Security Information Present`.
    - `securityInformation` string — The security information referenced by the `securityInformationQualifier` (`ISA-04`). Typically, this is a password.

## Response `200`

GenerateEdi 200 response

- GenerateEdiResponseContent
  - `edi` string — The EDI Stedi generated from the JSON transaction data.
  - `artifactId` string, required — An ID for the generated EDI file.
  - `fileExecutionId` string, required — A ID for the process Stedi uses to generate the EDI file. This ID appears on the details page for this file execution in the Stedi portal. Internally, Stedi uses this ID to place the file in Stedi's outbound queue.
  - `metadata` Metadata, required — Metadata about the generated EDI file.
    - `interchangeMetadata` InterchangeMetadata[], required — A list of interchange metadata for all interchanges in the EDI file.
      - `interchangeControlNumber` number, required
      - `functionalGroupControlNumbers` number[], required — A list of functional group control numbers within an interchange.

## Other responses

- `400` — BadRequestException 400 response
- `401` — UnauthorizedException 401 response
- `403` — AccessDeniedException 403 response
- `404` — ResourceNotFoundException 404 response
- `409` — ResourceUnderChangeException 409 response
- `422` — UnprocessableEntityException 422 response
- `429` — ThrottlingException 429 response
- `500` — ServiceException 500 response
- `503` — ServiceUnavailableException 503 response
- `504` — GatewayTimeoutException 504 response

---

[API](https://skmtc.net/stedi/apis/core.md) · [All operations](https://skmtc.net/stedi/apis/core/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/stedi/core/revisions/172bd33e0d66/schema)
