{"id":23613725,"url":"https://github.com/interfax/interfax-dotnet","last_synced_at":"2025-05-12T21:42:30.454Z","repository":{"id":9570686,"uuid":"62628744","full_name":"interfax/interfax-dotnet","owner":"interfax","description":"Fax send and receive in .NET with the InterFAX REST API","archived":false,"fork":false,"pushed_at":"2023-05-08T21:16:05.000Z","size":802,"stargazers_count":9,"open_issues_count":4,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-16T08:17:45.768Z","etag":null,"topics":["csharp","dotnet","fax","fax-api","hipaa","inbound","interfax","interfax-api","library","online-fax","outbound","receive","sdk","send","vb-net"],"latest_commit_sha":null,"homepage":"https://www.interfax.net/en/dev/dotnet","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interfax.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-05T10:39:17.000Z","updated_at":"2025-04-01T06:51:55.000Z","dependencies_parsed_at":"2024-06-19T05:18:58.221Z","dependency_job_id":"a7ab77e5-546f-4fe7-9a18-cda2922771eb","html_url":"https://github.com/interfax/interfax-dotnet","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interfax%2Finterfax-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interfax%2Finterfax-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interfax%2Finterfax-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interfax%2Finterfax-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interfax","download_url":"https://codeload.github.com/interfax/interfax-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253827867,"owners_count":21970595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","fax","fax-api","hipaa","inbound","interfax","interfax-api","library","online-fax","outbound","receive","sdk","send","vb-net"],"created_at":"2024-12-27T17:19:24.025Z","updated_at":"2025-05-12T21:42:30.406Z","avatar_url":"https://github.com/interfax.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InterFAX .NET Library\n\n[![NuGet version](https://badge.fury.io/nu/interfax.api.svg)](https://badge.fury.io/nu/interfax.api) [![Build Status](https://travis-ci.org/interfax/interfax-dotnet.svg?branch=master)](https://travis-ci.org/interfax/interfax-dotnet)\n\n[Installation](#installation) | [Getting Started](#getting-started) | [Running Tests](#running-tests) | [Contributing](#contributing) | [License](#license)\n\nSend and receive faxes in [CLI Languages](https://en.wikipedia.org/wiki/List_of_CLI_languages) with the [InterFAX REST API](https://www.interfax.net/en/dev/rest/reference).\n\n(examples are in C#)\n\n## Installation\n\nThis library targets .NET Standard 2.0/.NET 4.6.1+ and is installed via NuGet:\n```\nInstall-Package InterFAX.Api -Version 3.1.5\n```\n\nFor a full list of supported platforms see the [.NET Standard](https://github.com/dotnet/standard/blob/master/docs/versions.md) reference documentation.\n\n\nThe legacy PCL format package targetting .NET 4.5.2 is available as version 1.X.X:\n\n```\nInstall-Package InterFAX.Api -Version 1.0.5\n```\n\n__Warning:__ If building with VS2015, the NuGet package manager must be updated to v3.6+ in order to recognise .NET Standard packages within the IDE ([download](https://www.nuget.org/downloads)). If required, the updated package manager will additionally prompt and link to install an updated .NET standard runtime.\n\n(Advanced) For use with the [PCI compliant InterFAX API](https://www.interfax.net/en-us/dev/rest_pci/reference), select the InterFAX_PCI root during initialization (See [Client](#client))\n\n## Getting started\n\n\n# Usage\n\n[Client](#client) | [Account](#account) | [Outbound](#outbound) | [Inbound](#inbound) | [Documents](#documents)\n\n## Client\n\nCredentials are set through environment variables, or passed as parameters directly during initialization. Credentials passed as parameters take precedence over those set in the environment.\n\n```csharp\nusing InterFAX.Api;\n\n// | Initialize using parameters\nvar interfax = new FaxClient(username: \"...\", password: \"...\");\n\n// | Initialize using Environment variables\n// key : string \n// INTERFAX_USERNAME : InterFax Username\n// INTERFAX_PASSWORD : InterFax Password\nvar interfax = new FaxClient();\n\n// Initialize with a specific InterFAX API Endpoint (EG PCI Compliant)\n// InterFAX_Default: https://www.interfax.net/en-us/dev/rest/reference\n// InterFAX_PCI: https://www.interfax.net/en-us/dev/rest_pci/reference\nvar interfax = new FaxClient(apiRoot: FaxClient.ApiRoot.InterFAX_PCI);\n\n// Locale specific endpoints for data-sovereignty\n// InterFAX_US_PCI: USA\nvar interfax = new FaxClient(apiRoot: FaxClient.ApiRoot.InterFAX_US_PCI);\n// InterFAX_CA_PCI: Canada\nvar interfax = new FaxClient(apiRoot: FaxClient.ApiRoot.InterFAX_CA_PCI);\n\n```\n\nUse of configurationManager was removed in 2.0.0, due to conversion to .NET Standard.\n\nAll connections are established over HTTPS.\n\nClient must support TLS 1.1+ as of June 30th 2018 (See [TLS 1.0 End of Life](https://www.interfax.net/en/news/20180423))\n\n## Account\n\n### Balance\n\n`async Task\u003cdecimal\u003e GetBalance();`\n\nDetermine the remaining faxing credits in your account.\n\n```csharp\nvar interfax = new FaxClient();\n\nvar balance = await interfax.Account.GetBalance();\nConsole.WriteLine($\"Account balance is {balance}\"); //=\u003e Account balance is 9.86\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/3001)\n\n## Outbound\n\n[Send](#send-fax) | [Get list](#get-outbound-fax-list) | [Get completed list](#get-completed-fax-list) | [Get record](#get-outbound-fax-record) | [Get image stream](#get-outbound-fax-image-stream) | [Cancel fax](#cancel-a-fax) | [Search](#search-fax-list)\n\n### Send fax\n\n`async Task\u003cint\u003e SendFax(IFaxDocument faxDocument, SendOptions options)`\n`async Task\u003cint\u003e SendFax(List\u003cIFaxDocument\u003e faxDocuments, SendOptions options)`\n\nSubmit a fax to a single destination number. Returns the messageId of the fax.\n\nFor small documents, there are a few ways to send a fax. You can directly provide a file path, a file stream or a url, which can be a web page anywhere or a link to a previously uploaded document resource (see [Documents](#documents)).\n\n```csharp\nvar options = new SendOptions { FaxNumber = \"+11111111112\"};\n\n// with a path\nvar fileDocument = interfax.Documents.BuildFaxDocument(@\".\\folder\\fax.txt\");\nvar messageId = await interfax.Outbound.SendFax(fileDocument, options);\n\n// with a stream\n// NB : the caller is responsible for opening and closing the stream.\nusing (var fileStream = File.OpenRead(@\".\\folder\\fax.txt\"))\n{\n  var fileDocument = interfax.Documents.BuildFaxDocument(\"fax.txt\", fileStream);\n  var messageId = await interfax.Outbound.SendFax(fileDocument, options);\n}\n// with a byte array\nbyte[] file = ...\nvar urlDocument = interfax.Documents.BuildFaxDocument(file, \".pdf\"));\nvar messageId = await interfax.Outbound.SendFax(urlDocument, options);\n\n// with a URL\nvar urlDocument = interfax.Documents.BuildFaxDocument(new Uri(\"https://s3.aws.com/example/fax.html\"));\nvar messageId = await interfax.Outbound.SendFax(urlDocument, options);\n\n// or a combination\nvar documents = new List\u003cIFaxDocument\u003e { fileDocument, urlDocument };\nvar messageId = await interfax.Outbound.SendFax(documents, options)\n```\n\nInterFAX supports over 20 file types including HTML, PDF, TXT, Word, and many more. For a full list see the [Supported File Types](https://www.interfax.net/en/help/supported_file_types) documentation.\nThe supported types are mapped to media types in the file SupportedMediaTypes.json - this can be modified by hand.\n\nThe returned object is the Id of the fax. Use this Id to load more information, get the image, or cancel the sending of the fax.\n\n```csharp\nvar result = await interfax.CancelFax(messageId);\n\n// result in this case is just \"OK\".\n```\n**SendOptions:** [`FaxNumber`, `Contact`, `PostponeTime`, `RetriesToPerform`, `Csid`, `PageHeader`, `Reference`, `PageSize`, `FitToPage`, `PageOrientation`, `Resolution`, `Rendering`](https://www.interfax.net/en/dev/rest/reference/2918)\n\n---\n\n### Get outbound fax list\n\n`async Task\u003cIEnumerable\u003cOutboundFaxSummary\u003e\u003e GetList(Outbound.ListOptions options = null);`\n\nGet a list of recent outbound faxes (which does not include batch faxes).\n\n```csharp\nvar faxes = await interfax.Outbound.GetList();\n```\n\n**Outbound.ListOptions:** [`Limit`, `LastId`, `SortOrder`, `UserId`](https://www.interfax.net/en/dev/rest/reference/2920)\n\n---\n\n### Get completed fax list\n\n`async Task\u003cIEnumerable\u003cOutboundFaxSummary\u003e\u003e GetCompleted(params int[] ids)`\n\nGet details for a subset of completed faxes from a submitted list. (Submitted id's which have not completed are ignored).\n\n```csharp\nvar completed = await interfax.Outbound.GetCompleted(1, 2, 3);\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2972)\n\n----\n\n### Get outbound fax record\n\n`async Task\u003cOutboundFaxSummary\u003e GetFaxRecord(Int64 id);`\n\nRetrieves information regarding a previously-submitted fax, including its current status.\n\n```csharp\nvar fax = interfax.Outbound.GetFaxRecord(123456)\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2921)\n\n---\n\n### Get outbound fax image stream\n\n`async Task\u003cStream\u003e GetFaxImageStream(Int64 id);`\n\nRetrieve the fax image stream (TIFF file) of a submitted fax.\n\n```csharp\nusing (var imageStream = await _interfax.Outbound.GetFaxImageStream(662208217))\n{\n    using (var fileStream = File.Create(@\".\\image.tiff\"))\n    {\n        InterFAX.Utils.CopyStream(imageStream, fileStream);\n    }\n}\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2941)\n\n----\n\n### Cancel a fax\n\n`async Task\u003cstring\u003e CancelFax(Int64 id)`\n\nCancel a fax in progress.\n\n```csharp\nvar result = interfax.Outbound.CancelFax(123456)\n\n// =\u003e OK\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2939)\n\n----\n\n### Search fax list\n\n`async Task\u003cIEnumerable\u003cOutboundFax\u003e\u003e SearchFaxes(SearchOptions searchOptions)`\n\nSearch for outbound faxes.\n\n```csharp\nvar faxes = await interfax.Outbound.Search(new SearchOptions {\n  faxNumber = '+1230002305555'\n});\n```\n\n**Options:** [`Ids`, `Reference`, `DateFrom`, `DateTo`, `Status`, `UserId`, `FaxNumber`, `Limit`, `Offset`](https://www.interfax.net/en/dev/rest/reference/2959)\n\n## Inbound\n\n[Get list](#get-inbound-fax-list) | [Get record](#get-inbound-fax-record) | [Get image stream](#get-inbound-fax-image-stream) | [Get emails](#get-forwarding-emails) | [Mark as read](#mark-as-readunread) | [Resend to email](#resend-inbound-fax)\n\n### Get inbound fax list\n\n`async Task\u003cIEnumerable\u003cInboundFax\u003e\u003e GetList(ListOptions listOptions = null)`\n\nRetrieves a user's list of inbound faxes. (Sort order is always in descending ID).\n\n```csharp\nvar faxes = await interfax.Inbound.GetList(new ListOptions { UnreadOnly = true });\n```\n\n**Options:** [`UnreadOnly`, `Limit`, `LastId`, `AllUsers`](https://www.interfax.net/en/dev/rest/reference/2935)\n\n---\n\n### Get inbound fax record\n\n`async Task\u003cInboundFax\u003e GetFaxRecord(Int64 id)`\n\nRetrieves a single fax's metadata (receive time, sender number, etc.).\n\n```csharp\nvar fax = await interfax.Inbound.GetFaxRecord(123456);\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2938)\n\n---\n\n### Get inbound fax image stream\n\n`async Task\u003cStream\u003e GetFaxImageStream(Int64 id)`\n\nRetrieves a single fax's image.\n\n```csharp\nusing (var imageStream = await _interfax.Inbound.GetFaxImageStream(291704306))\n{\n    using (var fileStream = File.Create(@\".\\image.tiff\"))\n    {\n        Utils.CopyStream(imageStream, fileStream);\n    }\n}\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2937)\n\n---\n\n### Get forwarding emails\n\n`async Task\u003cIEnumerable\u003cForwardingEmail\u003e\u003e GetForwardingEmails(Int64 id)`\n\nRetrieve the list of email addresses to which a fax was forwarded.\n\n```csharp\nvar emails = await interfax.Inbound.GetForwardingEmails(12345);\nforeach(var email in emails)\n\tConsole.WriteLine($\"{email.EmailAddress}, {email.MessageStatus}, {email.CompletionTime.ToString(\"s\")}\")\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2930)\n\n---\n\n### Mark as read/unread\n\n`async Task\u003cstring\u003e MarkRead(Int64 id)`\n`async Task\u003cstring\u003e MarkUnread(Int64 id)`\n\nMark a transaction as read/unread.\n\n```csharp\n// mark as read\nvar result = interfax.Inbound.MarkRead(123456);\n\n// =\u003e OK\n\n// mark as unread\nvar result = interfax.Inbound.MarkUnread(123456);\n\n// =\u003e OK\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2936)\n\n### Resend inbound fax\n\n`async Task\u003cstring\u003e Resend(Int64 id, string emailAddress = null)`\n\nResend an inbound fax, optionally to a specific email address.\n\n```csharp\n// resend to the email(s) to which the fax was previously forwarded\nvar result = await interfax.Inbound.Resend(123456);\n\n// =\u003e OK\n\n// resend to a specific address\nvar result = await interfax.Inbound.Resend(123456) \"test@example.com\");\n\n// =\u003e OK\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2929)\n\n---\n\n## Documents\n\n[Create document upload session](#create-document-upload-session) | [Upload chunk](#upload-chunk) | [Get upload session list](#get-upload-session-list) | [Status](#get-upload-session-status) | [Cancel](#cancel-document-upload-session)\n\nDocument upload sessions allow for uploading of large files up to 20MB in chunks of arbitrary size.\n\nYou can do this with either a file path :\n\n`UploadSession UploadDocument(string filePath)`\n\n```csharp\nvar fileInfo = new FileInfo(\"test.pdf\"));\nvar session = _interfax.Outbound.Documents.UploadDocument(fileInfo.FullName);\n```\n\nOr with a file stream :\n\n`UploadSession UploadDocument(string fileName, FileStream fileStream)`\n\n```csharp\nusing (var fileStream = File.OpenRead(\"test.pdf\"))\n{\n  var session = _interfax.Outbound.Documents.UploadDocument(filePath, fileStream);\n}\n```\n\nThe Uri property of the returned session object can be used when sending a fax.\n\nIf you want to control the chunking yourself, the following example shows how you could upload a file in 500 byte chunks:\n\n```csharp\nvar fileInfo = new FileInfo(\"large.pdf\");\n\nvar sessionId = CreateUploadSession(new UploadSessionOptions\n{\n    Name = fileInfo.Name,\n    Size = (int) fileInfo.Length\n}).Result;\n\nusing (var fileStream = File.OpenRead(filePath))\n{\n    var buffer = new byte[500];\n    int len;\n    while ((len = fileStream.Read(buffer, 0, buffer.Length)) \u003e 0)\n    {\n        var data = new byte[len];\n        Array.Copy(buffer, data, len);\n        var response = UploadDocumentChunk(sessionId, fileStream.Position - len, data).Result;\n        if (response.StatusCode == HttpStatusCode.Accepted) continue;\n        if (response.StatusCode == HttpStatusCode.OK) break;\n    }\n}\n```\n\n### Create Document Upload Session\n\n`async Task\u003cstring\u003e CreateUploadSession(UploadSessionOptions options)`\n\nCreate a document upload session, allowing you to upload large files in chunks.\n\n```csharp\nvar sessionId = _interfax.Outbound.Documents.CreateUploadSession(options);\n```\n\n**Options:** [`Disposition`, `Sharing`](https://www.interfax.net/en/dev/rest/reference/2967)\n\n---\n\n### Upload chunk\n\n`async Task\u003cHttpResponseMessage\u003e UploadDocumentChunk(string sessionId, long offset, byte[] data)`\n\nUpload a chunk to an existing document upload session. The offset refers to the offset in the unchunked file not the data parameter.\n\n```csharp\nvar response = UploadDocumentChunk(sessionId, offset, data).Result;\n\n// HttpStatusCode.OK (done) or HttpStatusCode.Accepted (unfinished)\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2966)\n\n---\n\n### Get Upload Session List\n\n`async Task\u003cIEnumerable\u003cUploadSession\u003e\u003e GetUploadSessions(ListOptions listOptions = null)`\n\nGet a list of previous document uploads which are currently available.\n\n```csharp\nvar list = _interfax.Outbound.Documents.GetUploadSessions(new Documents.ListOptions\n                {\n                    Offset = 10,\n                    Limit = 5\n                }).Result;\n```\n\n**Options:** [`Limit`, `Offset`](https://www.interfax.net/en/dev/rest/reference/2968)\n\n---\n\n### Get upload session status\n\n`async Task\u003cUploadSession\u003e GetUploadSession(string sessionId)`\n\nGet the current status of a specific document upload session.\n\n```csharp\nvar session = interfax.Documents.GetUploadSession(123456);\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2965)\n\n---\n\n### Cancel document upload session\n\n`interfax.documents.cancel(document_id, callback);`\n\nCancel a document upload and tear down the upload session, or delete a previous upload.\n\n```csharp\nvar result = await interfax.Outbound.Documents.CancelUploadSession(sessionId);\n\n// =\u003e OK\n```\n\n**More:** [documentation](https://www.interfax.net/en/dev/rest/reference/2964)\n\n---\n## Running Tests\n\n### Manually (Visual Studio)\n1. Build the project\n2. Open the Test Explorer Test \u003e Windows \u003e Test Explorer\n3. \"Run All\"\n\n### Manually (CLI/Console Runner)\n1. Install the [.NET Core SDK](https://www.microsoft.com/net/download)\n2. Run ```dotnet test``` in the root or desired test folder\n\n### Note: Integration Testing\nIntegration tests require valid api credentials to pass, these can be provided within the testingConfig.cs within. A free developer account can be registered at [https://www.interfax.net/en/dev/register](https://www.interfax.net/en/dev/register).\n\n## Contributing\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull request** so that we can review your changes\n\n## License\n\nThis library is released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterfax%2Finterfax-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterfax%2Finterfax-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterfax%2Finterfax-dotnet/lists"}