# Create outlet

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/outlets/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/outlets/llms-full.txt.

POST http://localhost:8080/api/v1/outlets
Content-Type: application/json

Create a new outlet in Cata. POS adapters normalize their payload into this standard format before calling this endpoint.

Reference: https://apidocs.cata.sg/pos-integration-service-api/api/v-1/outlets/create-outlet

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/outlets:
    post:
      operationId: create-outlet
      summary: Create outlet
      description: >-
        Create a new outlet in Cata. POS adapters normalize their payload into
        this standard format before calling this endpoint.
      tags:
        - subpackage_api.subpackage_api/v1.subpackage_api/v1/outlets
      parameters:
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
        - name: X-Tenant-ID
          in: header
          description: Tenant identifier
          required: false
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_v1_outlets_Create outlet_Response_201'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostApiV1OutletsRequestBadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostApiV1OutletsRequestUnauthorizedError'
        '422':
          description: Unprocessable Entity (WebDAV) (RFC 4918)
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1OutletsRequestUnprocessableEntityError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                externalId:
                  type: string
                internalName:
                  type: string
                address:
                  $ref: >-
                    #/components/schemas/ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaAddress
                contact:
                  $ref: >-
                    #/components/schemas/ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaContact
                timezone:
                  type: string
                channelLinkId:
                  type: string
                locationId:
                  type: string
                visible:
                  type: boolean
              required:
                - name
                - externalId
                - internalName
                - address
                - contact
                - timezone
                - channelLinkId
                - locationId
                - visible
servers:
  - url: http://localhost:8080
components:
  schemas:
    ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaAddress:
      type: object
      properties:
        street1:
          type: string
        street2:
          type: string
        city:
          type: string
        stateProvince:
          type: string
        postalCode:
          type: string
        country:
          type: string
      required:
        - street1
        - street2
        - city
        - stateProvince
        - postalCode
        - country
      title: ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaAddress
    ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaContact:
      type: object
      properties:
        phone:
          type: string
        email:
          type: string
      required:
        - phone
        - email
      title: ApiV1OutletsPostRequestBodyContentApplicationJsonSchemaContact
    ApiV1OutletsPostResponsesContentApplicationJsonSchemaAddress:
      type: object
      properties:
        street1:
          type: string
        street2:
          type: string
        city:
          type: string
        state:
          type: string
        postalCode:
          type: string
        country:
          type: string
        latitude:
          type: number
          format: double
        longitude:
          type: number
          format: double
      required:
        - street1
        - street2
        - city
        - state
        - postalCode
        - country
        - latitude
        - longitude
      title: ApiV1OutletsPostResponsesContentApplicationJsonSchemaAddress
    ApiV1OutletsPostResponsesContentApplicationJsonSchemaContact:
      type: object
      properties:
        email:
          type: string
          format: email
        phone:
          type: string
        website:
          type: string
        contactName:
          type: string
      required:
        - email
        - phone
        - website
        - contactName
      title: ApiV1OutletsPostResponsesContentApplicationJsonSchemaContact
    ApiV1OutletsPostResponsesContentApplicationJsonSchemaOpeningHoursItems:
      type: object
      properties:
        dayOfWeek:
          type: integer
        openTime:
          type: string
        closeTime:
          type: string
        isClosed:
          type: boolean
      required:
        - dayOfWeek
        - openTime
        - closeTime
        - isClosed
      title: ApiV1OutletsPostResponsesContentApplicationJsonSchemaOpeningHoursItems
    ApiV1OutletsPostResponsesContentApplicationJsonSchemaCapabilities:
      type: object
      properties:
        acceptsDelivery:
          type: boolean
        acceptsPickup:
          type: boolean
        acceptsDineIn:
          type: boolean
      required:
        - acceptsDelivery
        - acceptsPickup
        - acceptsDineIn
      title: ApiV1OutletsPostResponsesContentApplicationJsonSchemaCapabilities
    api_v1_outlets_Create outlet_Response_201:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
        externalId:
          type: string
        internalName:
          type: string
        slug:
          type: string
        refCode:
          type: string
        imageUrl:
          type: string
          format: uri
        address:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaAddress
        contact:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaContact
        isOpen:
          type: boolean
        isBusy:
          type: boolean
        visible:
          type: boolean
        timezone:
          type: string
        openingHours:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaOpeningHoursItems
        capabilities:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaCapabilities
        locationId:
          type: string
        channelLinkId:
          type: string
        showStartDatetime:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - status
        - externalId
        - internalName
        - slug
        - refCode
        - imageUrl
        - address
        - contact
        - isOpen
        - isBusy
        - visible
        - timezone
        - openingHours
        - capabilities
        - locationId
        - channelLinkId
        - showStartDatetime
        - createdAt
        - updatedAt
      title: api_v1_outlets_Create outlet_Response_201
    ApiV1OutletsPostResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        details:
          type: string
        field:
          type: string
      required:
        - code
        - message
        - details
        - field
      title: ApiV1OutletsPostResponsesContentApplicationJsonSchemaError
    PostApiV1OutletsRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OutletsRequestBadRequestError
    PostApiV1OutletsRequestUnauthorizedError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OutletsRequestUnauthorizedError
    PostApiV1OutletsRequestUnprocessableEntityError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OutletsPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OutletsRequestUnprocessableEntityError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python api_v1_outlets_Create outlet_example
import requests

url = "http://localhost:8080/api/v1/outlets"

payload = {
    "name": "string",
    "externalId": "string",
    "internalName": "string",
    "address": {
        "street1": "string",
        "street2": "string",
        "city": "string",
        "stateProvince": "string",
        "postalCode": "string",
        "country": "string"
    },
    "contact": {
        "phone": "string",
        "email": "string"
    },
    "timezone": "string",
    "channelLinkId": "string",
    "locationId": "string",
    "visible": True
}
headers = {
    "X-Tenant-ID": "string",
    "X-Api-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript api_v1_outlets_Create outlet_example
const url = 'http://localhost:8080/api/v1/outlets';
const options = {
  method: 'POST',
  headers: {
    'X-Tenant-ID': 'string',
    'X-Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"string","externalId":"string","internalName":"string","address":{"street1":"string","street2":"string","city":"string","stateProvince":"string","postalCode":"string","country":"string"},"contact":{"phone":"string","email":"string"},"timezone":"string","channelLinkId":"string","locationId":"string","visible":true}'
};

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

```go api_v1_outlets_Create outlet_example
package main

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

func main() {

	url := "http://localhost:8080/api/v1/outlets"

	payload := strings.NewReader("{\n  \"name\": \"string\",\n  \"externalId\": \"string\",\n  \"internalName\": \"string\",\n  \"address\": {\n    \"street1\": \"string\",\n    \"street2\": \"string\",\n    \"city\": \"string\",\n    \"stateProvince\": \"string\",\n    \"postalCode\": \"string\",\n    \"country\": \"string\"\n  },\n  \"contact\": {\n    \"phone\": \"string\",\n    \"email\": \"string\"\n  },\n  \"timezone\": \"string\",\n  \"channelLinkId\": \"string\",\n  \"locationId\": \"string\",\n  \"visible\": true\n}")

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

	req.Header.Add("X-Tenant-ID", "string")
	req.Header.Add("X-Api-Key", "<apiKey>")
	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 api_v1_outlets_Create outlet_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/outlets")

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

request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = 'string'
request["X-Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"string\",\n  \"externalId\": \"string\",\n  \"internalName\": \"string\",\n  \"address\": {\n    \"street1\": \"string\",\n    \"street2\": \"string\",\n    \"city\": \"string\",\n    \"stateProvince\": \"string\",\n    \"postalCode\": \"string\",\n    \"country\": \"string\"\n  },\n  \"contact\": {\n    \"phone\": \"string\",\n    \"email\": \"string\"\n  },\n  \"timezone\": \"string\",\n  \"channelLinkId\": \"string\",\n  \"locationId\": \"string\",\n  \"visible\": true\n}"

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

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

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/outlets")
  .header("X-Tenant-ID", "string")
  .header("X-Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\",\n  \"externalId\": \"string\",\n  \"internalName\": \"string\",\n  \"address\": {\n    \"street1\": \"string\",\n    \"street2\": \"string\",\n    \"city\": \"string\",\n    \"stateProvince\": \"string\",\n    \"postalCode\": \"string\",\n    \"country\": \"string\"\n  },\n  \"contact\": {\n    \"phone\": \"string\",\n    \"email\": \"string\"\n  },\n  \"timezone\": \"string\",\n  \"channelLinkId\": \"string\",\n  \"locationId\": \"string\",\n  \"visible\": true\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v1/outlets', [
  'body' => '{
  "name": "string",
  "externalId": "string",
  "internalName": "string",
  "address": {
    "street1": "string",
    "street2": "string",
    "city": "string",
    "stateProvince": "string",
    "postalCode": "string",
    "country": "string"
  },
  "contact": {
    "phone": "string",
    "email": "string"
  },
  "timezone": "string",
  "channelLinkId": "string",
  "locationId": "string",
  "visible": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Api-Key' => '<apiKey>',
    'X-Tenant-ID' => 'string',
  ],
]);

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

```csharp api_v1_outlets_Create outlet_example
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/outlets");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-ID", "string");
request.AddHeader("X-Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"string\",\n  \"externalId\": \"string\",\n  \"internalName\": \"string\",\n  \"address\": {\n    \"street1\": \"string\",\n    \"street2\": \"string\",\n    \"city\": \"string\",\n    \"stateProvince\": \"string\",\n    \"postalCode\": \"string\",\n    \"country\": \"string\"\n  },\n  \"contact\": {\n    \"phone\": \"string\",\n    \"email\": \"string\"\n  },\n  \"timezone\": \"string\",\n  \"channelLinkId\": \"string\",\n  \"locationId\": \"string\",\n  \"visible\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift api_v1_outlets_Create outlet_example
import Foundation

let headers = [
  "X-Tenant-ID": "string",
  "X-Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "string",
  "externalId": "string",
  "internalName": "string",
  "address": [
    "street1": "string",
    "street2": "string",
    "city": "string",
    "stateProvince": "string",
    "postalCode": "string",
    "country": "string"
  ],
  "contact": [
    "phone": "string",
    "email": "string"
  ],
  "timezone": "string",
  "channelLinkId": "string",
  "locationId": "string",
  "visible": true
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/outlets")! 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()
```