Skip to content

create-document ​

Method: POST
Path: /customers/{customer_id}/documents

Tags: KYC documents

Summary ​

Create document

Storefront SDK Usage ​

SDK Method: sdk.customer.createDocument()

Example:

typescript
const { data, error } = await sdk.customer.createDocument({ document_type_id: "type-123", document_number: "DOC123", file: new File(["document bytes"], "certificate.pdf", { type: "application/pdf" }) });

TypeScript Definition ​

typescript
"create-document": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description customer id */
                customer_id: string;
            };
            cookie?: never;
        };
        requestBody: {
            content: {
                "application/json": {
                    document_type_id: string;
                    document_number: string;
                    note?: string;
                };
                "multipart/form-data": components["schemas"]["CreateDocument"];
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            document: components["schemas"]["Document"];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            403: components["responses"]["Forbidden"];
            404: components["responses"]["NotFound"];
            500: components["responses"]["InternalServerError"];
            504: components["responses"]["GatewayTimeout"];
        };
    };

Component References ​

ReferenceResolves To
components["schemas"]["CreateDocument"]CreateDocument
components["schemas"]["Document"]Document
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["Forbidden"]Forbidden
components["responses"]["NotFound"]NotFound
components["responses"]["InternalServerError"]InternalServerError
components["responses"]["GatewayTimeout"]GatewayTimeout

Request Body ​

Content Types: application/json, multipart/form-data

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.

403 ​

Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.

404 ​

Requested resource not found

500 ​

The request failed because of an unexpected error.

504 ​

The request timed out.

OpenAPI Definition ​

json
{
  "tags": [
    "KYC documents"
  ],
  "operationId": "create-document",
  "summary": "Create document",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/create-document",
    "description": "API reference for the create-document operation"
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "document_type_id",
            "document_number"
          ],
          "properties": {
            "document_type_id": {
              "type": "string",
              "maxLength": 32,
              "minLength": 1,
              "pattern": "\\S"
            },
            "document_number": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1,
              "pattern": "\\S"
            },
            "note": {
              "type": "string",
              "maxLength": 512,
              "minLength": 1,
              "pattern": "\\S"
            }
          }
        }
      },
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/CreateDocument"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "document": {
                    "$ref": "#/components/schemas/Document"
                  }
                },
                "required": [
                  "document"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "500": {
      "$ref": "#/components/responses/InternalServerError"
    },
    "504": {
      "$ref": "#/components/responses/GatewayTimeout"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "kyc",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "createDocument"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: