AlmondTill/G3N API

createPhysicalFacility

mutation · in the family Physical facility

What it does

Create a new physical facility — an actual building (a store, a warehouse) at your organization.

Create a PhysicalFacility in the caller's org group; requires the unrestricted capability.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Organization structure — Opening and closing organizations and facilities — the legal and physical structure of your group.

Roles that may call it:

Arguments

NameTypeRequiredNotes
inputNewPhysicalFacilityInput NewPhysicalFacilityInput!yesCreate-input for a PhysicalFacility.

Returns

PhysicalFacility PhysicalFacility! — A physical facility — an actual location of an Organization (parent = the org, NOT the family root); holds no address of its own — it references a PhysicalFacilityLocation (two or more orgs may share one PFL). NOT a policy level.

Example request

graphql
mutation ExampleCreatePhysicalFacility($input: NewPhysicalFacilityInput!) {
  createPhysicalFacility(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    physicalFacilityLocationId
    code
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "organizationId": "01900000-0000-7000-8000-1971e30a0000",
    "physicalFacilityLocationId": "01900000-0000-7000-8000-c5bdf77e0000"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createPhysicalFacility": {
      "id": "01900000-0000-7000-8000-adea048d0000",
      "sysId": "PF-EXMP-0000-000F",
      "type": "PhysicalFacility",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "physicalFacilityLocationId": "01900000-0000-7000-8000-c5bdf77e0000",
      "code": "BJ-001"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.

Used in