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

# Sync the baseline and many locations



## OpenAPI

````yaml /api-reference/openapi.json post /v1/locations:sync
openapi: 3.1.0
info:
  description: >-
    Send training events for your teammates and read back programs, body state
    and the reasons behind every change.
  title: TechnicallyFit Engine API
  version: 1.0.0
servers:
  - description: Production
    url: https://api.technicallyfit.com
  - description: Staging
    url: https://api-staging.technicallyfit.com
security:
  - ApiKey: []
tags:
  - name: Organization
  - name: Teammates
  - name: Events
  - name: Programs
  - name: Body state
  - name: Proposals
  - name: Webhooks
  - name: Locations
  - name: Insights
  - name: Reference
  - name: Sandbox
  - name: Attestations
paths:
  /v1/locations:sync:
    post:
      tags:
        - Locations
      summary: Sync the baseline and many locations
      operationId: syncLocations
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LocationsSyncRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationsSyncResponse'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
        5XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/RateLimitLimitDay'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/RateLimitRemainingDay'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Reset-Day:
              $ref: '#/components/headers/RateLimitResetDay'
      security:
        - ApiKey: []
components:
  schemas:
    LocationsSyncRequest:
      additionalProperties: false
      properties:
        archive_missing:
          default: false
          description: >-
            True archives every active location that is not in this request. Use
            it only when one request lists every location.
          type: boolean
        baseline:
          additionalProperties: false
          description: Replaces the baseline. Left out, the baseline is not touched.
          properties:
            items:
              description: The whole baseline. An item left out is removed from it.
              items:
                additionalProperties: false
                properties:
                  attributes:
                    additionalProperties:
                      minimum: 0
                      type: number
                    description: >-
                      Facts about the equipment, such as `max_load_kg`. Only the
                      attributes the equipment lists in `GET /v1/equipment` are
                      accepted.
                    type: object
                  count:
                    anyOf:
                      - maximum: 100000
                        minimum: 0
                        type: integer
                      - type: 'null'
                    description: How many the gym has. It changes no program.
                  token:
                    description: >-
                      An equipment token, name or other known spelling from `GET
                      /v1/equipment`. It is stored as the token.
                    maxLength: 120
                    minLength: 1
                    type: string
                required:
                  - token
                type: object
              maxItems: 500
              type: array
          required:
            - items
          type: object
        dry_run:
          default: true
          description: >-
            True (the default) answers what applying would change and writes
            nothing.
          type: boolean
        locations:
          description: >-
            Up to 100 locations, each created or replaced by its `external_id`.
            A location that is not listed is left as it is unless
            `archive_missing` is true.
          items:
            additionalProperties: false
            properties:
              address:
                anyOf:
                  - additionalProperties: false
                    properties:
                      city:
                        maxLength: 120
                        minLength: 1
                        type: string
                      country:
                        description: An ISO 3166-1 alpha-2 country code, such as `US`.
                        pattern: ^[A-Z]{2}$
                        type: string
                      line1:
                        maxLength: 200
                        minLength: 1
                        type: string
                      line2:
                        maxLength: 200
                        minLength: 1
                        type: string
                      postal_code:
                        maxLength: 32
                        minLength: 1
                        type: string
                      region:
                        maxLength: 120
                        minLength: 1
                        type: string
                    type: object
                  - type: 'null'
                description: Where the location is. Every part is optional.
              external_id:
                pattern: ^[A-Za-z0-9._:-]{1,255}$
                type: string
              name:
                maxLength: 255
                minLength: 1
                type: string
              overrides:
                description: >-
                  Every override of the location: only where it differs from the
                  baseline. Left out, its overrides are not touched; an empty
                  list clears them.
                items:
                  additionalProperties: false
                  properties:
                    attributes:
                      additionalProperties:
                        minimum: 0
                        type: number
                      description: >-
                        Facts about the equipment, such as `max_load_kg`. Only
                        the attributes the equipment lists in `GET
                        /v1/equipment` are accepted. Only with `added`.
                      type: object
                    back_in_service_on:
                      anyOf:
                        - pattern: ^\d{4}-\d{2}-\d{2}$
                          type: string
                        - type: 'null'
                      description: >-
                        Only with `out_of_service`. The first date the item can
                        be used again, in the time zone of the location. Left
                        out, it stays out of service until you remove the
                        override.
                    count:
                      anyOf:
                        - maximum: 100000
                          minimum: 0
                          type: integer
                        - type: 'null'
                      description: >-
                        How many the gym has. It changes no program. Only with
                        `added`.
                    kind:
                      description: >-
                        `added`: the location has it, with its own count.
                        `missing`: the location does not have a baseline item.
                        `out_of_service`: it cannot be used for now.
                      enum:
                        - added
                        - missing
                        - out_of_service
                      type: string
                    note:
                      anyOf:
                        - maxLength: 500
                          minLength: 1
                          type: string
                        - type: 'null'
                      description: >-
                        Only with `out_of_service`. Your own note, such as
                        `awaiting part`.
                    token:
                      description: >-
                        An equipment token, name or other known spelling from
                        `GET /v1/equipment`. It is stored as the token.
                      maxLength: 120
                      minLength: 1
                      type: string
                  required:
                    - token
                    - kind
                  type: object
                maxItems: 1000
                type: array
              region:
                anyOf:
                  - maxLength: 120
                    minLength: 1
                    type: string
                  - type: 'null'
              time_zone:
                maxLength: 64
                minLength: 1
                type: string
            required:
              - name
              - time_zone
              - external_id
            type: object
          maxItems: 100
          type: array
      required:
        - locations
      type: object
    LocationsSyncResponse:
      additionalProperties: false
      properties:
        applied:
          description: >-
            False for a dry run: nothing was written. The rest has the same
            shape.
          type: boolean
        baseline:
          additionalProperties: false
          properties:
            added:
              items:
                type: string
              type: array
            changed:
              type: boolean
            removed:
              items:
                type: string
              type: array
          required:
            - changed
            - added
            - removed
          type: object
        changes:
          description: >-
            Every location whose own record or effective inventory changes. A
            baseline change can reach locations that are not in the request:
            they show `action` `unchanged` with the equipment they gain or lose.
          items:
            additionalProperties: false
            properties:
              action:
                enum:
                  - created
                  - updated
                  - archived
                  - unchanged
                type: string
              effective_inventory:
                additionalProperties: false
                properties:
                  added:
                    items:
                      type: string
                    type: array
                  removed:
                    items:
                      type: string
                    type: array
                required:
                  - added
                  - removed
                type: object
              external_id:
                type: string
              teammates_to_replan:
                type: integer
            required:
              - external_id
              - action
              - effective_inventory
              - teammates_to_replan
            type: object
          type: array
        locations:
          additionalProperties: false
          description: >-
            What happened to the locations in the request, and to those archived
            because the request left them out.
          properties:
            archived:
              type: integer
            created:
              type: integer
            unchanged:
              type: integer
            updated:
              type: integer
          required:
            - created
            - updated
            - unchanged
            - archived
          type: object
        totals:
          additionalProperties: false
          properties:
            locations_with_inventory_change:
              type: integer
            teammates_to_replan:
              type: integer
          required:
            - locations_with_inventory_change
            - teammates_to_replan
          type: object
      required:
        - applied
        - baseline
        - locations
        - changes
        - totals
      type: object
    Error:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              description: >-
                A stable code. Known values: invalid_request, unauthorized,
                forbidden, consent_required, plan_required,
                attestor_not_approved, not_found, conflict, payload_too_large,
                validation_failed, rate_limit_exceeded, internal_error,
                engine_unavailable. More codes may be added, so handle one you
                do not know.
              type: string
              x-known-values:
                - invalid_request
                - unauthorized
                - forbidden
                - consent_required
                - plan_required
                - attestor_not_approved
                - not_found
                - conflict
                - payload_too_large
                - validation_failed
                - rate_limit_exceeded
                - internal_error
                - engine_unavailable
            details:
              additionalProperties:
                description: 'contract: open'
              type: object
            message:
              description: A sentence a person can read.
              type: string
            request_id:
              description: >-
                Equals the X-Request-ID response header. Send it to support with
                a question.
              type: string
          required:
            - code
            - message
            - request_id
            - details
          type: object
      required:
        - error
      type: object
  headers:
    RateLimitLimit:
      description: How many requests this key may make in one minute.
      schema:
        minimum: 0
        type: integer
    RateLimitLimitDay:
      description: How many requests this key may make in one UTC day.
      schema:
        minimum: 0
        type: integer
    RateLimitRemaining:
      description: How many requests this key has left in the current minute.
      schema:
        minimum: 0
        type: integer
    RateLimitRemainingDay:
      description: How many requests this key has left in the current UTC day.
      schema:
        minimum: 0
        type: integer
    RateLimitReset:
      description: When the current minute ends, in seconds since the Unix epoch.
      schema:
        minimum: 0
        type: integer
    RateLimitResetDay:
      description: The next UTC midnight, in seconds since the Unix epoch.
      schema:
        minimum: 0
        type: integer
    RetryAfter:
      description: How many seconds to wait before sending the request again.
      schema:
        minimum: 0
        type: integer
  securitySchemes:
    ApiKey:
      in: header
      name: X-API-Key
      type: apiKey

````

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