# sendConnectionRequest

This method allows you to send a connection request to a person.

```typescript
try {
  const workflow = await linkedapi.sendConnectionRequest.execute({
    personUrl: "https://www.linkedin.com/in/john-doe",
    note: "Hello! I'd love to connect and discuss opportunities.",
    email: "john.doe@example.com", // Optional: required by some people
  });

  const { errors } = await linkedapi.sendConnectionRequest.result(
    workflow.workflowId,
  );

  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn("Workflow completed with execution errors:");
    errors.forEach((error) => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  } else {
    console.log("Connection request sent successfully.");
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error("An unexpected, non-API error occurred:", e);
  }
}
```

```python
from linkedapi import SendConnectionRequestParams, LinkedApiError

try:
    workflow = linkedapi.send_connection_request.execute(
        SendConnectionRequestParams(
            person_url="https://www.linkedin.com/in/john-doe",
            note="Hello! I'd love to connect and discuss opportunities.",
            email="john.doe@example.com",  # Optional: required by some people
        )
    )

    result = linkedapi.send_connection_request.result(workflow.workflow_id)
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")
    else:
        print("Connection request sent successfully.")
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `personUrl` – [public or hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the person you want to send a connection request to.
- `note` (optional) – note to include with the connection request. LinkedIn limits note length and may limit how many personalized invitation notes a free account can send.
- `email` (optional) – email address required by some people for sending connection requests to them. If it is required and not provided, the connection request will fail.

## Data

The method doesn't return any data.

## Errors

- `personNotFound` – provided URL is not an existing LinkedIn person.
- `selfProfileNotAllowed` – action cannot be performed on your own profile.
- `alreadyPending` – connection request to this person has already been sent and is still pending.
- `alreadyConnected` – your LinkedIn account is already connected with this person.
- `emailRequired` – person requires an email address to send a connection request.
- `noteTooLong` – the note exceeds the character limit allowed by LinkedIn. Free accounts are limited to 200 characters, Premium accounts to 300.
- `noteLimitExceeded` – your LinkedIn account has reached the limit for personalized invitation notes. Send the connection request without a note, or buy LinkedIn Premium to include one.
- `requestNotAllowed` – LinkedIn has restricted sending a connection request to this person. This can happen for the following reasons:
  - The person has disabled connection requests in their privacy settings.
  - You recently sent and withdrew a connection request to this person.
  - You have reached LinkedIn's daily, weekly, or monthly limits for sending connection requests.
