Occunet AppDev avatar image
Occunet AppDev asked Occunet AppDev commented

C# Sending Fax - Parameter [to] value is invalid.

We are using NugetPackage 6.1.1 and getting "Parameter [to] value is invalid." when sending a fax.

The error message and examination of the code in the RingCentral.Net library shows that the request is being sent as formData with a request.json parameter and the CreateMessageRequest serialized as JSON.

Is this correct? Should the library be sending FormData with individual paramters?

RingCentral.RestException: 'Response:

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:


Date: Fri, 09 Feb 2024 21:38:57 GMT

Connection: keep-alive

RCRequestId: a11e264c-c793-11ee-a688-005056bbd8ff

RoutingKey: SJC11P01PAS01

X-Rate-Limit-Group: heavy

X-Rate-Limit-Limit: 10

X-Rate-Limit-Remaining: 9

X-Rate-Limit-Window: 60

CF-Cache-Status: DYNAMIC

Server: cloudflare

CF-RAY: 852f43222dcd6c20-DFW

Content-Type: application/json;charset=utf-8

Content-Length: 246

Content-Language: en-US


Content: {

"errorCode" : "InvalidParameter",

"message" : "Parameter [to] value is invalid.",

"errors" : [ {

"errorCode" : "CMN-101",

"message" : "Parameter [to] value is invalid.",

"parameterName" : "to"

} ],

"parameterName" : "to"



Method: POST, RequestUri: '', Version: 1.1, Content: System.Net.Http.MultipartFormDataContent, Headers:


X-User-Agent: Unknown/0.0.1 RingCentral.Net/6.1.1

Authorization: Bearer ***

Request-Context: appId=cid-v1:e4663832-4025-415d-9de8-032949192fbf

Request-Id: |2fb8e6b3fe3342300ee87c258eb31fc7.250cf52c456bb8fc.

traceparent: 00-2fb8e6b3fe3342300ee87c258eb31fc7-250cf52c456bb8fc-00

Content-Type: multipart/form-data; boundary="6891f609-723d-4277-8042-4621dbca7605"

Content-Length: 260466


Content: --6891f609-723d-4277-8042-4621dbca7605

Content-Type: application/json; charset=utf-8

Content-Disposition: form-data; name=request.json

{"faxResolution":"High","to":[{"phoneNumber":"+**********"}],"sendTime":"2/9/2024 2:06 PM"}


Content-Type: application/pdf

Content-Disposition: form-data; name=attachments; filename=Negotiation_178370-ScaCoversheet.pdf; filename*=utf-8''Negotiation_178370-ScaCoversheet.pdf



1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered Occunet AppDev commented

Check out this dev guide sample code. The bodyParams must be the CreateFaxMessageRequest object and the "to" is the FaxReceiver[].

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Occunet AppDev avatar image Occunet AppDev commented ·

That is exactly what we have used to create our fax request. Is there a specific format for the phone or "to" values as the examples don't show how those are formatted. We use the .Net SDK to create all of this, yet it does not work.

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Occunet AppDev commented ·

I can't find this object name "CreateMessageRequest" from the error trace you posted so I don't know where did you see it. Did you create the request using that object?

I just sent a test fax again using my code and it worked well.

Send a high resolution fax message to a recipient number
static private async Task send_fax()
    var bodyParams = new CreateFaxMessageRequest(); = new FaxReceiver[]
          new FaxReceiver { phoneNumber = "+1209252XXXX" }
    bodyParams.faxResolution = "High";
    bodyParams.coverPageText = "This is a demo Fax page from C#";

    var attachment = new Attachment { filename = "test.jpg", contentType = "image/jpeg", content = System.IO.File.ReadAllBytes("test.jpg") };
    var attachments = new Attachment[] { attachment };
    bodyParams.attachments = attachments;

    var resp = await restClient.Restapi().Account().Extension().Fax().Post(bodyParams);
    Console.WriteLine("Fax sent. Message id: " +;
    await check_fax_message_status(;

Check the sending message status until it's no longer in the queued status
static private async Task check_fax_message_status(string messageId)
        var resp = await restClient.Restapi().Account().Extension().MessageStore(messageId).Get();
        Console.WriteLine("Message status: " + resp.messageStatus);
        if (resp.messageStatus == "Queued")
            await check_fax_message_status(;
    catch (Exception ex)

If everything is correct in your code, maybe it's truly the to fax number is invalid. You can submit a dev support ticket to get help.

0 Likes 0 ·
Occunet AppDev avatar image Occunet AppDev Phong Vu ♦♦ commented ·

Ok, let me stub your test code into our API and see if it sends. You don't see the Type CreateMessageRequest because this is an HTTP response, so it doesn't know about the type. But when building the request to send, we are using the CreateMessageRequest from the RingCentral SDK.

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys