> ## Documentation Index
> Fetch the complete documentation index at: https://docs.assetinfinity.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a site

> Add one site, with the same numbering, rules, reference checks and approval gate as the Sites screen.

`p_values` holds the site's fields — `name` is the only one that must be sent, and the site code is assigned by the tenant's numbering. `p_custom_fields` holds answers to the tenant's own fields, keyed by field key. Returns the new site, or `status: PENDING_APPROVAL` where the tenant's approval rules hold it.

To change a site afterwards, call `update_record` with `core.sites` as the entity.



## OpenAPI

````yaml /api-reference/integration.json post /rpc/create_site
openapi: 3.0.0
info:
  description: >-
    The calls an integration needs first. Every endpoint the application uses is
    in the complete reference.
  title: Asset Infinity integration API
  version: 12.2.3
servers:
  - url: https://app.assetinfinity.ai/api
security: []
tags:
  - description: >-
      Exchange an API key, or an email and password, for a short-lived session
      token, and send it as `Authorization: Bearer <token>` on every other call.
    name: Signing in
  - description: >-
      Where assets are and work happens. A location belongs to a site and may
      sit inside another location.
    name: Sites and locations
  - description: >-
      The asset register: read it, add to it, correct it, move an asset between
      sites and locations, and change its status.
    name: Assets
  - description: >-
      Report a problem. A request is triaged by a person, who turns it into a
      work order or turns it down.
    name: Work requests
  - description: >-
      Raise a job, give it to somebody, move it through the organisation's
      statuses, complete it and close it.
    name: Work orders
  - description: >-
      Send readings in. A meter reading brings the meter forward and raises any
      maintenance the usage has made due. A sensor reading can open or clear an
      alert.
    name: Meters and sensors
  - description: >-
      The part catalogue and what is on the shelf in each store, and the three
      movements an outside system most often records: a delivery in, an issue
      out and a correction.
    name: Parts and stock
  - description: >-
      Have the product call your system when something happens, instead of
      asking it on a timer.
    name: Webhooks
  - description: >-
      The calls behind every register that has no call of its own, answers to
      the organisation's own fields, and the two calls that answer what to send.
      `list_options` returns the ids a field accepts. `describe_call` returns
      the fields any call takes.
    name: Any record
externalDocs:
  description: PostgREST Documentation
  url: https://postgrest.org/en/v12/references/api.html
paths:
  /rpc/create_site:
    post:
      tags:
        - Sites and locations
      summary: Add a site
      description: >-
        Add one site, with the same numbering, rules, reference checks and
        approval gate as the Sites screen.


        `p_values` holds the site's fields — `name` is the only one that must be
        sent, and the site code is assigned by the tenant's numbering.
        `p_custom_fields` holds answers to the tenant's own fields, keyed by
        field key. Returns the new site, or `status: PENDING_APPROVAL` where the
        tenant's approval rules hold it.


        To change a site afterwards, call `update_record` with `core.sites` as
        the entity.
      parameters:
        - $ref: '#/components/parameters/preferParams'
      requestBody:
        content:
          application/json:
            schema:
              description: >-
                Add one site, with the same numbering, rules, reference checks
                and approval gate as the Sites screen.


                `p_values` holds the site's fields — `name` is the only one that
                must be sent, and the site code is assigned by the tenant's
                numbering. `p_custom_fields` holds answers to the tenant's own
                fields, keyed by field key. Returns the new site, or `status:
                PENDING_APPROVAL` where the tenant's approval rules hold it.


                To change a site afterwards, call `update_record` with
                `core.sites` as the entity.
              properties:
                p_custom_fields:
                  format: jsonb
                p_values:
                  description: >-
                    The fields of the new record. Send only the ones you have;
                    the rest take their defaults.
                  properties:
                    address_line1:
                      description: Address line 1.
                      maxLength: 200
                      type: string
                    address_line2:
                      description: Address line 2.
                      maxLength: 200
                      type: string
                    alternate_site_head_user_id:
                      description: >-
                        Alternate Site Head. Who answers for the site when the
                        head does not. Named separately on a workflow step, so a
                        step that should reach both says both. The id of a row
                        from users.
                      format: uuid
                      type: string
                    business_unit_id:
                      description: >-
                        Business Unit. How the site rolls up for reporting. The
                        id of a row from business units.
                      format: uuid
                      type: string
                    city:
                      description: City.
                      maxLength: 120
                      type: string
                    company_id:
                      description: >-
                        Company. The legal entity that owns it. The id of a row
                        from companies.
                      format: uuid
                      type: string
                    country_id:
                      description: Country. The id of a row from countries.
                      format: uuid
                      type: string
                    currency_id:
                      description: >-
                        Currency. The currency costs are entered in here by
                        default. The id of a row from currencies.
                      format: uuid
                      type: string
                    is_active:
                      description: >-
                        Active. Turning this off keeps the site's history but
                        stops new work being raised against it.
                      type: boolean
                    latitude:
                      description: >-
                        Coordinates. Decimal degrees. Used to place the site on
                        a map and to work out travel time to it.
                      type: number
                    locale_id:
                      description: >-
                        Locale. How dates and numbers are formatted for people
                        working at this site. The id of a row from locales.
                      format: uuid
                      type: string
                    name:
                      description: Name. The full name of the site or depot.
                      maxLength: 200
                      type: string
                    postal_code:
                      description: Postal Code.
                      maxLength: 30
                      type: string
                    site_head_user_id:
                      description: >-
                        Site Head. Who is accountable for everything that
                        happens at this site. Approvals and escalations routed
                        to the site's head reach this person. The id of a row
                        from users.
                      format: uuid
                      type: string
                    state_province_id:
                      description: State Province. The id of a row from states provinces.
                      format: uuid
                      type: string
                    timezone:
                      description: >-
                        Timezone. The site's own clock. Due dates, shift
                        patterns and SLA clocks are all read in it, so leaving
                        this at UTC for a site that is not in UTC makes work
                        appear late.
                      maxLength: 100
                      type: string
                  required:
                    - name
                  type: object
              required:
                - p_values
              type: object
          application/vnd.pgrst.object+json:
            schema:
              description: >-
                Add one site, with the same numbering, rules, reference checks
                and approval gate as the Sites screen.


                `p_values` holds the site's fields — `name` is the only one that
                must be sent, and the site code is assigned by the tenant's
                numbering. `p_custom_fields` holds answers to the tenant's own
                fields, keyed by field key. Returns the new site, or `status:
                PENDING_APPROVAL` where the tenant's approval rules hold it.


                To change a site afterwards, call `update_record` with
                `core.sites` as the entity.
              properties:
                p_custom_fields:
                  format: jsonb
                p_values:
                  description: >-
                    The fields of the new record. Send only the ones you have;
                    the rest take their defaults.
                  properties:
                    address_line1:
                      description: Address line 1.
                      maxLength: 200
                      type: string
                    address_line2:
                      description: Address line 2.
                      maxLength: 200
                      type: string
                    alternate_site_head_user_id:
                      description: >-
                        Alternate Site Head. Who answers for the site when the
                        head does not. Named separately on a workflow step, so a
                        step that should reach both says both. The id of a row
                        from users.
                      format: uuid
                      type: string
                    business_unit_id:
                      description: >-
                        Business Unit. How the site rolls up for reporting. The
                        id of a row from business units.
                      format: uuid
                      type: string
                    city:
                      description: City.
                      maxLength: 120
                      type: string
                    company_id:
                      description: >-
                        Company. The legal entity that owns it. The id of a row
                        from companies.
                      format: uuid
                      type: string
                    country_id:
                      description: Country. The id of a row from countries.
                      format: uuid
                      type: string
                    currency_id:
                      description: >-
                        Currency. The currency costs are entered in here by
                        default. The id of a row from currencies.
                      format: uuid
                      type: string
                    is_active:
                      description: >-
                        Active. Turning this off keeps the site's history but
                        stops new work being raised against it.
                      type: boolean
                    latitude:
                      description: >-
                        Coordinates. Decimal degrees. Used to place the site on
                        a map and to work out travel time to it.
                      type: number
                    locale_id:
                      description: >-
                        Locale. How dates and numbers are formatted for people
                        working at this site. The id of a row from locales.
                      format: uuid
                      type: string
                    name:
                      description: Name. The full name of the site or depot.
                      maxLength: 200
                      type: string
                    postal_code:
                      description: Postal Code.
                      maxLength: 30
                      type: string
                    site_head_user_id:
                      description: >-
                        Site Head. Who is accountable for everything that
                        happens at this site. Approvals and escalations routed
                        to the site's head reach this person. The id of a row
                        from users.
                      format: uuid
                      type: string
                    state_province_id:
                      description: State Province. The id of a row from states provinces.
                      format: uuid
                      type: string
                    timezone:
                      description: >-
                        Timezone. The site's own clock. Due dates, shift
                        patterns and SLA clocks are all read in it, so leaving
                        this at UTC for a site that is not in UTC makes work
                        appear late.
                      maxLength: 100
                      type: string
                  required:
                    - name
                  type: object
              required:
                - p_values
              type: object
          application/vnd.pgrst.object+json;nulls=stripped:
            schema:
              description: >-
                Add one site, with the same numbering, rules, reference checks
                and approval gate as the Sites screen.


                `p_values` holds the site's fields — `name` is the only one that
                must be sent, and the site code is assigned by the tenant's
                numbering. `p_custom_fields` holds answers to the tenant's own
                fields, keyed by field key. Returns the new site, or `status:
                PENDING_APPROVAL` where the tenant's approval rules hold it.


                To change a site afterwards, call `update_record` with
                `core.sites` as the entity.
              properties:
                p_custom_fields:
                  format: jsonb
                p_values:
                  description: >-
                    The fields of the new record. Send only the ones you have;
                    the rest take their defaults.
                  properties:
                    address_line1:
                      description: Address line 1.
                      maxLength: 200
                      type: string
                    address_line2:
                      description: Address line 2.
                      maxLength: 200
                      type: string
                    alternate_site_head_user_id:
                      description: >-
                        Alternate Site Head. Who answers for the site when the
                        head does not. Named separately on a workflow step, so a
                        step that should reach both says both. The id of a row
                        from users.
                      format: uuid
                      type: string
                    business_unit_id:
                      description: >-
                        Business Unit. How the site rolls up for reporting. The
                        id of a row from business units.
                      format: uuid
                      type: string
                    city:
                      description: City.
                      maxLength: 120
                      type: string
                    company_id:
                      description: >-
                        Company. The legal entity that owns it. The id of a row
                        from companies.
                      format: uuid
                      type: string
                    country_id:
                      description: Country. The id of a row from countries.
                      format: uuid
                      type: string
                    currency_id:
                      description: >-
                        Currency. The currency costs are entered in here by
                        default. The id of a row from currencies.
                      format: uuid
                      type: string
                    is_active:
                      description: >-
                        Active. Turning this off keeps the site's history but
                        stops new work being raised against it.
                      type: boolean
                    latitude:
                      description: >-
                        Coordinates. Decimal degrees. Used to place the site on
                        a map and to work out travel time to it.
                      type: number
                    locale_id:
                      description: >-
                        Locale. How dates and numbers are formatted for people
                        working at this site. The id of a row from locales.
                      format: uuid
                      type: string
                    name:
                      description: Name. The full name of the site or depot.
                      maxLength: 200
                      type: string
                    postal_code:
                      description: Postal Code.
                      maxLength: 30
                      type: string
                    site_head_user_id:
                      description: >-
                        Site Head. Who is accountable for everything that
                        happens at this site. Approvals and escalations routed
                        to the site's head reach this person. The id of a row
                        from users.
                      format: uuid
                      type: string
                    state_province_id:
                      description: State Province. The id of a row from states provinces.
                      format: uuid
                      type: string
                    timezone:
                      description: >-
                        Timezone. The site's own clock. Due dates, shift
                        patterns and SLA clocks are all read in it, so leaving
                        this at UTC for a site that is not in UTC makes work
                        appear late.
                      maxLength: 100
                      type: string
                  required:
                    - name
                  type: object
              required:
                - p_values
              type: object
          text/csv:
            schema:
              description: >-
                Add one site, with the same numbering, rules, reference checks
                and approval gate as the Sites screen.


                `p_values` holds the site's fields — `name` is the only one that
                must be sent, and the site code is assigned by the tenant's
                numbering. `p_custom_fields` holds answers to the tenant's own
                fields, keyed by field key. Returns the new site, or `status:
                PENDING_APPROVAL` where the tenant's approval rules hold it.


                To change a site afterwards, call `update_record` with
                `core.sites` as the entity.
              properties:
                p_custom_fields:
                  format: jsonb
                p_values:
                  description: >-
                    The fields of the new record. Send only the ones you have;
                    the rest take their defaults.
                  properties:
                    address_line1:
                      description: Address line 1.
                      maxLength: 200
                      type: string
                    address_line2:
                      description: Address line 2.
                      maxLength: 200
                      type: string
                    alternate_site_head_user_id:
                      description: >-
                        Alternate Site Head. Who answers for the site when the
                        head does not. Named separately on a workflow step, so a
                        step that should reach both says both. The id of a row
                        from users.
                      format: uuid
                      type: string
                    business_unit_id:
                      description: >-
                        Business Unit. How the site rolls up for reporting. The
                        id of a row from business units.
                      format: uuid
                      type: string
                    city:
                      description: City.
                      maxLength: 120
                      type: string
                    company_id:
                      description: >-
                        Company. The legal entity that owns it. The id of a row
                        from companies.
                      format: uuid
                      type: string
                    country_id:
                      description: Country. The id of a row from countries.
                      format: uuid
                      type: string
                    currency_id:
                      description: >-
                        Currency. The currency costs are entered in here by
                        default. The id of a row from currencies.
                      format: uuid
                      type: string
                    is_active:
                      description: >-
                        Active. Turning this off keeps the site's history but
                        stops new work being raised against it.
                      type: boolean
                    latitude:
                      description: >-
                        Coordinates. Decimal degrees. Used to place the site on
                        a map and to work out travel time to it.
                      type: number
                    locale_id:
                      description: >-
                        Locale. How dates and numbers are formatted for people
                        working at this site. The id of a row from locales.
                      format: uuid
                      type: string
                    name:
                      description: Name. The full name of the site or depot.
                      maxLength: 200
                      type: string
                    postal_code:
                      description: Postal Code.
                      maxLength: 30
                      type: string
                    site_head_user_id:
                      description: >-
                        Site Head. Who is accountable for everything that
                        happens at this site. Approvals and escalations routed
                        to the site's head reach this person. The id of a row
                        from users.
                      format: uuid
                      type: string
                    state_province_id:
                      description: State Province. The id of a row from states provinces.
                      format: uuid
                      type: string
                    timezone:
                      description: >-
                        Timezone. The site's own clock. Due dates, shift
                        patterns and SLA clocks are all read in it, so leaving
                        this at UTC for a site that is not in UTC makes work
                        appear late.
                      maxLength: 100
                      type: string
                  required:
                    - name
                  type: object
              required:
                - p_values
              type: object
        required: true
      responses:
        '200':
          description: OK
components:
  parameters:
    preferParams:
      description: Preference
      in: header
      name: Prefer
      required: false
      schema:
        enum:
          - params=single-object
        type: string

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.