# Create an immigration case

POST https://api.letsdeel.com/rest/v2/immigration/client/cases
Content-Type: application/json

Create an immigration case.
 **Token scopes**: `immigration:write`

Reference: https://developer.deel.com/api/endpoints/immigration/create-client-case

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Deel HRIS SCIM API
  version: 1.0.0
paths:
  /immigration/client/cases:
    post:
      operationId: create-client-case
      summary: Create an immigration case
      description: |-
        Create an immigration case.
         **Token scopes**: `immigration:write`
      tags:
        - subpackage_immigration
      parameters:
        - name: Authorization
          in: header
          description: >
            ## Authentication

            The Deel API uses bearer tokens to authenticate requests. All API
            calls must be made over HTTPS — calls over plain HTTP or without
            authentication will fail.


            ```curl

            curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
              -H 'Authorization: Bearer YOUR-TOKEN-HERE'
            ```


            [Learn more about authentication](/api/authentication)
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/immigration_createClientCase_Response_201'
        '400':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CreateAnImmigrationCaseRequestBadRequestError
        '401':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '403':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '404':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '500':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CreateAnImmigrationCaseRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: >-
                    #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData
servers:
  - url: https://api.letsdeel.com/rest/v2
  - url: https://api-staging.letsdeel.com/rest/v2
components:
  schemas:
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf0CaseType:
      type: string
      enum:
        - RIGHT_TO_WORK
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf0CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData0:
      type: object
      properties:
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf0CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        contract_id:
          type: string
          description: >-
            The contract object identifier. Required for document reviews and
            visa applications
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
      required:
        - case_type
        - contract_id
        - country_code
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData0
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf1CaseType:
      type: string
      enum:
        - EOR_VISA
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf1CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData1:
      type: object
      properties:
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf1CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        contract_id:
          type: string
          description: >-
            The contract object identifier. Required for document reviews and
            visa applications
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
        visa_type_id:
          type: string
          format: uuid
          description: >-
            The id of visa type that is being applied for. Identifies the type
            of the visa.
      required:
        - case_type
        - contract_id
        - country_code
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData1
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf2CaseType:
      type: string
      enum:
        - SPONSORED_VISA
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf2CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData2:
      type: object
      properties:
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf2CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        entity_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the entity sponsoring the visa. Required
            for sponsored visa applications
        contract_id:
          type: string
          description: >-
            The contract object identifier. Required for document reviews and
            visa applications
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
        visa_type_id:
          type: string
          format: uuid
          description: >-
            The id of visa type that is being applied for. Identifies the type
            of the visa.
      required:
        - case_type
        - entity_id
        - contract_id
        - country_code
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData2
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf3CaseType:
      type: string
      enum:
        - PRE_HIRE_EOR_VISA
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf3CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData3:
      type: object
      properties:
        team_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the team for which the pre-hire visa case
            is being created
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf3CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
        visa_type_id:
          type: string
          format: uuid
          description: >-
            The id of visa type that is being applied for. Identifies the type
            of the visa.
      required:
        - team_id
        - case_type
        - country_code
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData3
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf4CaseType:
      type: string
      enum:
        - PRE_HIRE_SPONSORSHIP_VISA
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf4CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData4:
      type: object
      properties:
        team_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the team for which the pre-hire sponsorship
            visa case is being created
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf4CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        entity_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the entity sponsoring the visa. Required
            for sponsored visa applications
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
        visa_type_id:
          type: string
          format: uuid
          description: >-
            The id of visa type that is being applied for. Identifies the type
            of the visa.
      required:
        - team_id
        - case_type
        - country_code
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData4
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5CaseType:
      type: string
      enum:
        - BUSINESS_VISA
      description: >-
        The type of immigration case to be created. Determines the workflow and
        requirements
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5CaseType
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5EmployeeDetails:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Employee's email address.  Required if contract_id is not provided
        last_name:
          type: string
          description: Employee's last name.  Required if contract_id is not provided
        residence:
          type: string
          description: ISO 3166-1 alpha-2 country code of employee's current residence
        first_name:
          type: string
          description: Employee's first name.  Required if contract_id is not provided
        citizenships:
          type: array
          items:
            type: string
          description: >-
            List of ISO 3166-1 alpha-2 country codes representing employee's
            citizenships
      required:
        - residence
        - citizenships
      description: >-
        Employee information. Citizenships and residence attributes are always
        required for business visa cases. The remaining fields are only required
        when no contract_id is present.
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5EmployeeDetails
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformationPurpose:
      type: string
      enum:
        - INTERNAL_BUSINESS_WITH_WORK_FOR_CLIENT
        - INTERNAL_BUSINESS_WITHOUT_WORK_FOR_CLIENT
        - MEETINGS_WITH_OR_FOR_A_CLIENT
        - MEETINGS_WITH_POTENTIAL_CLIENTS
        - NEGOTIATING_CONTRACTS_OR_SIGNING_AGREEMENTS
        - OTHER_EXTERNAL_BUSINESS
        - CONFERENCE
        - TEAM_OFFSITE
        - SPEAKING_AT_CONFERENCE_UNPAID
        - SPEAKING_AT_CONFERENCE_PAID
        - ATTENDING_INTERNAL_TRAINING
        - ATTENDING_EXTERNAL_TRAINING
        - DELIVERING_TRAINING_TO_INTERNAL_PARTICIPANTS
        - DELIVERING_TRAINING_TO_EXTERNAL_PARTICIPANTS_UNPAID
        - DELIVERING_TRAINING_TO_EXTERNAL_PARTICIPANTS_PAID
        - PARTICIPATION_IN_RESEARCH_PROJECTS_AND_STUDIES
        - ASSEMBLY_MAINTENANCE_REPAIR_INSTALLATION
        - TECHNICAL_SUPPORT_OR_SUPERVISION
        - OTHER_HANDS_ON_LABOUR
        - MARKET_RESEARCH_AND_EXPLORING_INVESTMENT_OPPORTUNITIES
        - OTHER
      description: The purpose of the business trip
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformationPurpose
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformation:
      type: object
      properties:
        purpose:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformationPurpose
          description: The purpose of the business trip
        end_date:
          type: string
          format: date
          description: Trip end date in YYYY-MM-DD format
        start_date:
          type: string
          format: date
          description: Trip start date in YYYY-MM-DD format
      required:
        - purpose
        - end_date
        - start_date
      description: Travel details for the business visa
      title: >-
        ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformation
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData5:
      type: object
      properties:
        team_id:
          type: string
          format: uuid
          description: >-
            The id of the team for which the employee will be added to. Required
            if contract_id is not provided
        case_type:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5CaseType
          description: >-
            The type of immigration case to be created. Determines the workflow
            and requirements
        entity_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the entity sponsoring the visa. Required
            for sponsored visa applications
        contract_id:
          type: string
          description: >-
            The contract object identifier. If not provided, employee_details
            and team_id become required
        country_code:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the immigration case needs to
            be processed
        visa_type_id:
          type: string
          format: uuid
          description: >-
            The id of visa type that is being applied for. Identifies the type
            of the visa
        employee_details:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5EmployeeDetails
          description: >-
            Employee information. Citizenships and residence attributes are
            always required for business visa cases. The remaining fields are
            only required when no contract_id is present.
        travel_information:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaDataOneOf5TravelInformation
          description: Travel details for the business visa
      required:
        - case_type
        - country_code
        - visa_type_id
        - employee_details
        - travel_information
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData5
    ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData:
      oneOf:
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData0
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData1
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData2
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData3
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData4
        - $ref: >-
            #/components/schemas/ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData5
      title: ImmigrationClientCasesPostRequestBodyContentApplicationJsonSchemaData
    ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataStatus:
      type: string
      enum:
        - OPEN
        - CLOSED
        - ON_HOLD
      description: Current status of the case
      title: >-
        ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataStatus
    ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataProcess:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the process
        status_name:
          type: string
          description: Human-readable status of the process
        process_name:
          type: string
          description: Name of the immigration process
      required:
        - id
        - status_name
        - process_name
      description: Details about the current immigration process associated with the case
      title: >-
        ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataProcess
    ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the case
        status:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataStatus
          description: Current status of the case
        process:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaDataProcess
          description: >-
            Details about the current immigration process associated with the
            case
        created_at:
          type: string
          format: date-time
          description: Timestamp when the case was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the case was last updated
        closure_note:
          type:
            - string
            - 'null'
          description: Optional note explaining why the case was closed
        closure_reason:
          type:
            - string
            - 'null'
          description: Standardized reason for case closure
      required:
        - id
        - status
        - process
        - created_at
        - updated_at
      description: The immigration case data returned after successful creation
      title: ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaData
    immigration_createClientCase_Response_201:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaData
          description: The immigration case data returned after successful creation
      required:
        - data
      title: immigration_createClientCase_Response_201
    ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaErrorsItems:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code
        message:
          type: string
          description: Human-readable explanation of the error
      title: >-
        ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaErrorsItems
    CreateAnImmigrationCaseRequestBadRequestError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaErrorsItems
      title: CreateAnImmigrationCaseRequestBadRequestError
    ApiErrorRequest:
      type: object
      properties:
        method:
          type: string
          description: The HTTP method of the failed request
        url:
          type: string
          description: The relative URL of the failed request
        status:
          type: number
          format: double
          description: The status code of the response
        api_req_id:
          type: string
          description: The request ID of the failed request
        docs:
          type: string
          description: >-
            A link to the official documentation for the requested endpoint
            resource
        source:
          type: string
          description: The source handler which produced the returned error
        code:
          type: number
          format: double
          description: The code of the source handler which produced the returned error
      title: ApiErrorRequest
    ApiError:
      type: object
      properties:
        message:
          type: string
          description: A description of the returned error
        path:
          type: string
          description: The JSON path where input validation failed
      title: ApiError
    ApiErrorContainer:
      type: object
      properties:
        request:
          $ref: '#/components/schemas/ApiErrorRequest'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
      title: ApiErrorContainer
    CreateAnImmigrationCaseRequestInternalServerError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/ImmigrationClientCasesPostResponsesContentApplicationJsonSchemaErrorsItems
      title: CreateAnImmigrationCaseRequestInternalServerError
  securitySchemes:
    deelToken:
      type: http
      scheme: bearer
      description: >
        ## Authentication

        The Deel API uses bearer tokens to authenticate requests. All API calls
        must be made over HTTPS — calls over plain HTTP or without
        authentication will fail.


        ```curl

        curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
          -H 'Authorization: Bearer YOUR-TOKEN-HERE'
        ```


        [Learn more about authentication](/api/authentication)
    oauth2:
      type: http
      scheme: bearer
      description: >-
        Standard OAuth2 security scheme based on
        https://swagger.io/docs/specification/authentication/

```

## SDK Code Examples

```python
import requests

url = "https://api.letsdeel.com/rest/v2/immigration/client/cases"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.letsdeel.com/rest/v2/immigration/client/cases';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.letsdeel.com/rest/v2/immigration/client/cases"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.letsdeel.com/rest/v2/immigration/client/cases")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.letsdeel.com/rest/v2/immigration/client/cases")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.letsdeel.com/rest/v2/immigration/client/cases', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.letsdeel.com/rest/v2/immigration/client/cases");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.letsdeel.com/rest/v2/immigration/client/cases")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```