Skip to main content

Getting error "Enter a valid file" while creating sign request

  • January 2, 2024
  • 1 reply
  • 223 views

Api Path : https://{{api.box.com}}/2.0/sign_requests


Request Body:


{

  "is_document_preparation_needed": true,

  "parent_folder": {

    "id": "242033790140",

    "type": "folder"

  },

  "name": "new file",

  "days_valid": 2,

  "source_files": [

    {

      "id": "1402075677437",

      "type": "file"

    }

  ],

  "signature_color": "blue",

  "signers": [

    {

      "email": "abc@gmail.com",

      "role": "final_copy_reader"

    }

  ]

}


Response :


{

    "type": "error",

    "code": "bad_request",

    "status": 400,

    "message": "Bad request",

    "help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",

    "request_id": "0161f8a960ede1346f50bfdc34b75156f",

    "context_info": {

        "errors": [

            {

                "name": "source_files",

                "message": "Enter a valid file.",

                "reason": "invalid_parameter"

            }

        ]

    }

}

1 reply

rbarbosa Box
  • Developer Advocate
  • 553 replies
  • January 2, 2024

Hi @vikas161 , welcome to the forum.


From the error my immediate question is what type of file are you trying to sign?


My next question is you’re not specifying a signer, just the final copy reader, so are you trying to sign the file yourself, meaning the application logged user?


Here is a quick start exemple, almost identical to your own:


curl --location 'https://api.box.com/2.0/sign_requests' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer <access token>'

--data-raw '{

    "is_document_preparation_needed": true,

    "parent_folder": {

        "id": "234102987614",

        "type": "folder"

    },

    "source_files": [

        {

            "id": "1355143830404",

            "type": "file"

        }

    ],

    "signers": [

        {

            "email": "signer@example.com",

            "role": "signer"

        }

    ]

}'


Resulting in:


{

    "is_document_preparation_needed": true,

    "signers": [

        {

            "email": "requester@example.com",

            "role": "final_copy_reader",

        },

        {

            "email": "signer@example.com",

            "role": "signer",

        }

    ],

    "id": "348decab-48a8-4f2c-9436-8967afebf7bb",

    "prepare_url": "https://app.box.com/sign/document/xyz-abc-123/.../prepare_doc/",

    "source_files": [

        {

            "id": "1355143830404",

            "type": "file",

        }

    ],

    "parent_folder": {

        "id": "234102987614",

        "type": "folder",

    },

    "name": "Simple-PDF.pdf",

    "type": "sign-request",

    "status": "converting",

    "sign_files": {

        "files": [

            {

                "id": "1381301154812",

                "type": "file",

            }

        ],

        "is_ready_for_download": true

    },

    "template_id": null

}


Help us understand your use case a bit better.


Check out this FAQ on supported file types. Essentially if Box can convert it to a PDF, it should be able to sign it.




Cheers


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings