> This page is for Compatibility API.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# Receive

The `<Receive>` verb tells SignalWire to receive an incoming fax, which results in the creation of a new Fax instance resource.

Faxes remain stored indefinitely. To delete a fax, use the appropriate API call from the [Compatibility API](/docs/compatibility-api/rest/faxes/delete-fax).

## Verb attributes

**`action`** `string`

The URL to request when a fax has failed or has been received.

---

**`mediaType`** `string` — default: application/pdf

The type of media used to store fax media. Valid values are `application/pdf` or `image/tiff`.

---

**`method`** `string` — default: POST

The `method` attribute specifies whether the request to `action` is a `GET` or a `POST`. Valid values are `GET` or `POST`.

---

**`pageSize`** `string` — default: letter

The size to interpret incoming pages as. Valid values are `letter`, `legal`, or `a4`.

---

## Action callback

If the verb attribute `action` is specified, the action callback will include the [Standard Fax Request Parameters](/docs/compatibility-api/cxml/reference/fax#request-parameters) plus the following optional parameters:

**`ErrorCode`** `string`

The error code provides more information on a failed fax.

---

**`ErrorMessage`** `string`

The message explaining the reason for fax failure.

---

**`FaxStatus`** `string`

The status of the fax.

---

**`MediaUrl`** `string`

The media URL to request to retrieve incoming media.

---

**`NumPages`** `integer`

The number of pages received from a successful fax.

---

**`RemoteStationId`** `string`

The transmitting subscriber identification (TSID) reported by the fax machine that sent in the fax.

---

## Examples

### Receive a fax

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Receive action="/fax/received"/>
</Response>
```

**`Node.js`**

```javascript title="Node.js"
const { RestClient } = require("@signalwire/compatibility-api");
const response = new RestClient.LaML.FaxResponse();

response.receive({ action: "/fax/received" });
console.log(response.toString());
```

```csharp
using Twilio.TwiML;
using Twilio.TwiML.Fax;
using System;


class Example
{
    static void Main()
    {
        var response = new FaxResponse();
        response.Receive(action: "/fax/received"));

        Console.WriteLine(response.ToString());;
    }
}
```

```python
from signalwire.fax_response import FaxResponse, Receive

response = FaxResponse()
response.receive(action="/fax/received")

print(response)
```

```ruby
require 'signalwire/sdk'

response = Signalwire::Sdk::FaxResponse.new do |response|
  response.receive(action: "/fax/received")
end

puts response.to_s
```

SignalWire will receive the incoming fax and provide a URL endpoint.

### Store fax image

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Receive mediaType="image/tiff"></Receive>
</Response>
```

**`Node.js`**

```javascript title="Node.js"
const { RestClient } = require("@signalwire/compatibility-api");
const response = new RestClient.LaML.FaxResponse();

response.receive({ mediaType: "image/tiff" });
console.log(response.toString());
```

```csharp
using Twilio.TwiML;
using Twilio.TwiML.Fax;
using System;


class Example
{
    static void Main()
    {
        var response = new FaxResponse();
        response.Receive(mediaType: "image/tiff"));

        Console.WriteLine(response.ToString());;
    }
}
```

```python
from signalwire.fax_response import FaxResponse, Receive

response = FaxResponse()
response.receive(media_type="image/tiff")

print(response)
```

```ruby
require 'signalwire/sdk'

response = Signalwire::Sdk::FaxResponse.new do |response|
  response.receive(media_type: "image/tiff")
end

puts response.to_s
```

This example shows that the media from the incoming fax will be stored on SignalWire's server in TIFF format.

---

\*Twilio and TwiML are trademarks of Twilio, Inc. SignalWire, Inc. and its products are not affiliated with or endorsed by Twilio, Inc.