## Generate login link

### MCP server URL

```
https://docs.1099policy.com/mcp
```

### Standard setup for AI tools providing an mcp.json file

```json
{
  "1099Policy MCP server": {
    "url": "https://docs.1099policy.com/mcp"
  }
}
```

### Endpoint

**POST**  
/api/v1/contractors/{contractor}/login_link

Generates a secure, time-limited login URL for contractor portal access. This allows agencies to provide direct portal access without requiring contractors to go through email verification.

#### Path parameters
- **contractor**  
  *string, Required*  
  The contractor's public ID

#### Body
- **redirect_url**  
  *string*  
  URL to redirect the contractor to after successful authentication. Must match an allowlisted origin.

### Responses
- **200**  
  *application/json*  
  Login link generated successfully

- **contractor**  
    *object*  
    - **company_name**  
      *string*  
    - **email**  
      *string*  
    - **first_name**  
      *string*  
    - **id**  
      *integer*  
    - **last_name**  
      *string*  
    - **public_id**  
      *string*  
  - **expires_at**  
    *integer(int64)*  
    Time at which the login token expires. Measured in seconds since the Unix epoch.
  - **login_url**  
    *string*  
    Complete login URL with embedded token.
  - **success**  
    *boolean*

- **400**  
  Contractor has no email address, or the supplied redirect_url is not an allowlisted origin.
- **404**  
  Contractor not found.
- **500**  
  Failed to generate login link.

### Example Request

```curl  
curl \  
 --request POST 'https://api.1099policy.com/api/v1/contractors/{contractor}/login_link' \  
 --header "Content-Type: application/json" \  
 --data '{"redirect_url":"https://my.1099policy.com/insurance/start"}'
```

### Login URL Example Response
```json
{
  "redirect_url": "https://my.1099policy.com/insurance/start"
}
```

### Success Example Response
```json
{
  "contractor": {
    "company_name": "string",
    "email": "string",
    "first_name": "string",
    "id": 42,
    "last_name": "string",
    "public_id": "string"
  },
  "expires_at": 1765555200,
  "login_url": "https://my.1099policy.com/quick-access?contractor_id=cn_abc123&token=xyz789",
  "success": true
}
```
