---
updatedAt: 2025-02-19T21:54:54.000Z
agentTools:
  projectIndex: https://readme.teamogy.com/llms.txt
---

# Create user

Creates new user and returns saved user ID

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Teamogy API"
  },
  "servers": [
    {
      "url": "https://{host}/"
    }
  ],
  "paths": {
    "/rest/v1/{agencyId}/users": {
      "post": {
        "tags": [
          "Users API"
        ],
        "summary": "Create user",
        "description": "Creates new user and returns saved user ID",
        "operationId": "pubSaveUser",
        "security": [
          {
            "TeamogyTokenAPIAuthorizer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PubUserNew"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "host",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Specific domain your company have registered. For example 'yourcompany.teamogy.com'"
          },
          {
            "name": "agencyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the Business Unit"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PubUserNew"
                }
              }
            }
          }
        },
        "x-public": true,
        "x-amazon-apigateway-integration": {
          "uri": "http://api.test.com:9443/rest/r/v1/{agencyId}/users",
          "responses": {
            "default": {
              "statusCode": 200
            }
          },
          "requestParameters": {
            "integration.request.path.agencyId": "method.request.path.agencyId",
            "integration.request.header.X-Forwarded-Host": "method.request.header.host"
          },
          "passthroughBehavior": "when_no_match",
          "connectionType": "VPC_LINK",
          "connectionId": "${stageVariables.VPCLink}",
          "httpMethod": "POST",
          "type": "http_proxy"
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "TeamogyTokenAPIAuthorizer": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-amazon-apigateway-authtype": "custom",
        "x-amazon-apigateway-authorizer": {
          "authorizerUri": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:468062090586:function:TeamogyTokenAPIAuthorizer/invocations",
          "authorizerResultTtlInSeconds": 0,
          "type": "token"
        }
      }
    },
    "schemas": {
      "PersonBase": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "jobTitle": {
                "type": "string"
              },
              "salut": {
                "type": "string"
              },
              "namePrefix": {
                "type": "string"
              },
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "nameSuffix": {
                "type": "string"
              },
              "birthday": {
                "type": "string",
                "format": "date"
              },
              "comment": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PubUserNew": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PubUserBase"
          },
          {
            "type": "object",
            "properties": {
              "groupNames": {
                "type": "array",
                "description": "Array of usernames",
                "items": {
                  "type": "string"
                }
              },
              "properties": {
                "type": "object",
                "additionalProperties": true,
                "description": "Other User properties (optional fields, field names and value types MUST match Teamogy configuration)"
              }
            }
          }
        ]
      },
      "PubUserBase": {
        "type": "object",
        "required": [
          "id",
          "name",
          "email",
          "phone",
          "language"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "person": {
            "$ref": "#/components/schemas/PubPerson"
          },
          "managerId": {
            "type": "integer",
            "format": "int64"
          },
          "isDisabled": {
            "type": "boolean",
            "description": "Indication user is not valid anymore"
          },
          "isDraft": {
            "type": "boolean",
            "description": "Indication user is in draft state"
          },
          "managerUserName": {
            "type": "string"
          },
          "primaryAgencyId": {
            "type": "integer"
          },
          "language": {
            "type": "string"
          }
        }
      },
      "PubContact": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ContactBase"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64"
              }
            }
          }
        ]
      },
      "ContactBase": {
        "allOf": [
          {
            "type": "object",
            "required": [
              "name",
              "value"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PubPerson": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PersonBase"
          },
          {
            "type": "object",
            "required": [
              "lastName"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64"
              },
              "addressId": {
                "type": "integer",
                "format": "int64",
                "description": "ID of chosen address"
              },
              "contacts": {
                "type": "array",
                "description": "Array of aditional Contacts",
                "items": {
                  "$ref": "#/components/schemas/PubContact"
                }
              }
            }
          }
        ]
      }
    }
  },
  "x-amazon-apigateway-request-validators": {
    "Validate body, query string parameters, and headers": {
      "validateRequestParameters": true,
      "validateRequestBody": true
    }
  },
  "x-amazon-apigateway-minimum-compression-size": 10000,
  "x-amazon-apigateway-binary-media-types": [
    "multipart/form-data",
    "application/octet-stream",
    "application/pdf",
    "image/*",
    "audio/*",
    "video/*",
    "application/msword",
    "application/rtf",
    "application/vnd.ms-excel",
    "application/vnd.ms-powerpoint",
    "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "text/csvText",
    "text/plain",
    "application/x-zip-compressed",
    "application/zip",
    "application/rar"
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```