# Detect provider

> **POST** `https://api.us.nylas.com/v3/providers/detect`

Source: https://developer.nylas.com/docs/reference/api/connectors-integrations/detect_provider_by_email/

Returns the provider if one is detected. This operation is rate limited to 20 calls per minute for each Nylas application ID.

**Authentication:** NYLAS_API_KEY

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | Yes | Email for detection |
| `all_provider_types` | boolean | No | Search by all providers regardless of if they have an existing connector |

## Responses

### 200 - Returns the autodetected provider

- `request_id` (string) - ID of the request
- `data` (object)
  - `provider` (string) - Provider detected.
  - `type` (string) - Provider type. Returned only when IMAP detected displays the IMAP provider.
  - `email_address` (string) **(required)** - Email provided for autodetection.
  - `detected` (boolean) **(required)** - Whether Nylas detected a provider for the given email address.

### 401 - Not Authenticated

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.us.nylas.com/v3/providers/detect?email=<EMAIL>&all_provider_types=false' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

const detectProvider = async () => {
  try {
    const response = await nylas.auth.detectProvider({
      email: "<EMAIL>",
    });

    console.log("Detected provider:", response);
  } catch (error) {
    console.error("Error detecting provider:", error);
  }
};

detectProvider();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>",
)

response = nylas.auth.detect_provider({
    "email": "<EMAIL>",
})

print("Detected provider:", response)

```

### Ruby SDK

```ruby
require 'nylas'

nylas = Nylas::Client.new(
    api_key: "<NYLAS_API_KEY>"
)

provider, _ = nylas.auth.detect_provider({ email: "<EMAIL>" })

puts provider

```

### Java SDK

```java
import com.nylas.NylasClient;
import com.nylas.models.*;

public class detect_provider {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();
    ProviderDetectParams params = new ProviderDetectParams.Builder("<EMAIL>").build();
    Response<ProviderDetectResponse> provider = nylas.auth().detectProvider(params);

    System.out.println(provider);
  }
}
```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient
import com.nylas.models.ProviderDetectParams

fun main(args: Array<String>) {
  val nylas: NylasClient = NylasClient(
      apiKey = "<NYLAS_API_KEY>"
  )

  val params = ProviderDetectParams("<EMAIL>")
  val provider = nylas.auth().detectProvider(params)

  print(provider)
}
```
