---
updatedAt: 2026-05-27T08:20:12.000Z
agentTools:
  projectIndex: https://developers.youtrust.com/llms.txt
---

# Replace a Document in a Signature Request

Replace the file of a given Document.

When replacing a Document, the following features are not available:

* Add Initiales to the new Document.
* Parse Smart Anchors on the new Document.\
  Workaround: 1. Delete the existing document. 2. Re-upload it using the upload endpoint.
* Add a password-protected Document.

<br />

Related guide: [Document](https://developers.youtrust.com/docs/document-1).

***

**🔓 Endpoint access**

* Environments: `production`, `sandbox`
* API key scopes: `organization`, `workspace`
* Plans: `plus`, `pro`, `scale`
* Add-ons (for production access): *none*

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "email": "contact@youtrust.com",
      "name": "Support",
      "url": "https://youtrust.com/contact"
    },
    "description": "Build the best experience of digital signature through your own platform. Increase your conversion rates, leverage your data and reduce your costs with Youtrust API.",
    "license": {
      "name": "proprietary",
      "url": "https://youtrust.com/terms"
    },
    "title": "Public Api v3",
    "version": "3.0"
  },
  "servers": [
    {
      "description": "Sandbox URL",
      "url": "https://api-sandbox.yousign.app/v3"
    },
    {
      "description": "Production URL",
      "url": "https://api.yousign.app/v3"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "description": "Document that is attached to the Signature Request.",
      "name": "Document"
    }
  ],
  "paths": {
    "/signature_requests/{signatureRequestId}/documents/{documentId}/replace": {
      "post": {
        "description": "Replace the file of a given Document.",
        "operationId": "post-signature_requests-signatureRequestId-documents-documentId-replace",
        "parameters": [
          {
            "description": "Signature Request Id",
            "in": "path",
            "name": "signatureRequestId",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          },
          {
            "description": "Document Id",
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/post_signature_requests_signatureRequestId_documents_documentId_replace_request"
              }
            }
          }
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestResponse"
                }
              }
            },
            "description": "Bad request",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedResponse"
                }
              }
            },
            "description": "Access unauthorized",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenResponse"
                }
              }
            },
            "description": "Access forbidden",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundResponse"
                }
              }
            },
            "description": "Resource not found",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "405": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MethodNotAllowed"
                }
              }
            },
            "description": "This method is not allowed",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/retry-after"
              }
            }
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnsupportedMediaTypeResponse"
                }
              }
            },
            "description": "UnsupportedMediaType",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TooManyRequestsResponse"
                }
              }
            },
            "description": "Too Many Requests, please try again later.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/retry-after"
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            },
            "description": "Internal Server Error",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/rateLimit-limit"
              },
              "X-RateLimit-Limit-Hour": {
                "$ref": "#/components/headers/rateLimit-limit-hour"
              },
              "X-RateLimit-Limit-Minute": {
                "$ref": "#/components/headers/rateLimit-limit-minute"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/rateLimit-remaining"
              },
              "X-RateLimit-Remaining-Hour": {
                "$ref": "#/components/headers/rateLimit-remaining-hour"
              },
              "X-RateLimit-Remaining-Minute": {
                "$ref": "#/components/headers/rateLimit-remaining-minute"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/rateLimit-reset"
              }
            }
          }
        },
        "summary": "Replace a Document in a Signature Request",
        "tags": [
          "Document"
        ]
      }
    }
  },
  "components": {
    "headers": {
      "rateLimit-limit": {
        "description": "The maximum number of requests that the consumer is permitted to make in a given period",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-limit-hour": {
        "description": "The maximum number of requests that the consumer is permitted to make in an hour window",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-limit-minute": {
        "description": "The maximum number of requests that the consumer is permitted to make in an minute window",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-remaining": {
        "description": "The number of requests remaining in the current rate limit window",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-remaining-hour": {
        "description": "The number of requests remaining in the current hour rate limit window",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-remaining-minute": {
        "description": "The number of requests remaining in the current minute rate limit window",
        "schema": {
          "type": "integer"
        }
      },
      "rateLimit-reset": {
        "description": "The remaining time until the rate limit resets in seconds",
        "schema": {
          "type": "integer"
        }
      },
      "retry-after": {
        "description": "Retry the request after X seconds",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "UUID": {
        "description": "The unique identifier for a resource.",
        "example": "9a93d3b5-fb3b-4abf-9e70-26315b33506c",
        "format": "uuid",
        "type": "string"
      },
      "Document": {
        "description": "Document to attach to a Signature Request",
        "properties": {
          "id": {
            "example": "89120884-d29a-4b1a-ac7b-a9e73a872796",
            "format": "uuid",
            "type": "string"
          },
          "filename": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string"
          },
          "nature": {
            "enum": [
              "attachment",
              "signable_document"
            ],
            "type": "string"
          },
          "content_type": {
            "example": "application/pdf",
            "type": "string"
          },
          "sha256": {
            "description": "Sha256 checksum",
            "type": "string"
          },
          "is_protected": {
            "type": "boolean"
          },
          "is_signed": {
            "type": "boolean"
          },
          "created_at": {
            "example": "2024-01-18T22:59:00Z",
            "format": "date-time",
            "type": "string"
          },
          "total_pages": {
            "description": "Number of pages for signable document",
            "minimum": 1,
            "nullable": true,
            "type": "integer"
          },
          "is_locked": {
            "description": "If protected by password and not yet unlocked",
            "type": "boolean"
          },
          "initials": {
            "$ref": "#/components/schemas/Document_initials"
          },
          "total_anchors": {
            "description": "Number of parsed anchors from the document.",
            "type": "integer"
          },
          "excluded_approvers": {
            "description": "List of Approver IDs who cannot see this Document.\n",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "excluded_signers": {
            "description": "List of Signer IDs who cannot see this Document.\n",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "content_type",
          "created_at",
          "excluded_approvers",
          "excluded_signers",
          "filename",
          "id",
          "initials",
          "is_locked",
          "is_protected",
          "is_signed",
          "nature",
          "sha256",
          "total_anchors",
          "total_pages"
        ],
        "title": "Document",
        "type": "object"
      },
      "BadRequestResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "BadRequestResponse",
        "type": "object"
      },
      "UnauthorizedResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "UnauthorizedResponse",
        "type": "object"
      },
      "ForbiddenResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "ForbiddenResponse",
        "type": "object"
      },
      "NotFoundResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "NotFoundResponse",
        "type": "object"
      },
      "MethodNotAllowed": {
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "title": "MethodNotAllowed",
        "type": "object"
      },
      "UnsupportedMediaTypeResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "UnsupportedMediaTypeResponse",
        "type": "object"
      },
      "TooManyRequestsResponse": {
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "title": "TooManyRequestsResponse",
        "type": "object"
      },
      "InternalServerError": {
        "properties": {
          "type": {
            "example": "about:blank",
            "type": "string"
          },
          "detail": {
            "example": "Something wrong occurred.",
            "type": "string"
          }
        },
        "required": [
          "detail",
          "type"
        ],
        "title": "InternalServerError",
        "type": "object"
      },
      "post_signature_requests_signatureRequestId_documents_documentId_replace_request": {
        "properties": {
          "file": {
            "description": "Accepted formats: PDF, DOCX, JPEG, JPG and PNG. All files are converted to PDF upon upload.\nIf the Document nature is signable_document, only PDF or DOCX file formats are allowed.\n",
            "format": "binary",
            "type": "string"
          },
          "name": {
            "description": "The document name. If not set, will use the uploaded document name. This value should contain any characters except \"\\\", \"/\" and can\\'t start and finish with a space.",
            "example": "file1",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^(?!\\s)[^\\/\\\\]+(?<!\\s)$",
            "type": "string"
          }
        },
        "required": [
          "file"
        ],
        "type": "object"
      },
      "Document_initials_per_page_inner": {
        "properties": {
          "page": {
            "description": "Page number.",
            "minimum": 1,
            "type": "integer"
          },
          "y": {
            "description": "Y-axis position of the initials on the page.",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "page",
          "y"
        ],
        "type": "object"
      },
      "Document_initials": {
        "nullable": true,
        "properties": {
          "alignment": {
            "description": "Alignment of the initials on the document’s pages.",
            "enum": [
              "left",
              "center",
              "right"
            ],
            "type": "string"
          },
          "y": {
            "description": "Y-axis position of the initials on the first page of the document.",
            "minimum": 0,
            "type": "integer"
          },
          "per_page": {
            "items": {
              "$ref": "#/components/schemas/Document_initials_per_page_inner"
            },
            "type": "array"
          }
        },
        "required": [
          "alignment",
          "per_page",
          "y"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```