# /organizations/{organizationId}/subaccounts/{subaccountId}/memberships/{membershipId}

Update membership roles for a subaccount. Optional roles: omit the field to leave roles unchanged. Only roles for products included in the request are changed. Optional firstName and/or lastName update the member name; omitted name parts keep the existing stored value.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Partner API",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://admin.formstack.com/api/v1",
      "description": "Partner API"
    }
  ],
  "paths": {
    "/organizations/{organizationId}/subaccounts/{subaccountId}/memberships/{membershipId}": {
      "patch": {
        "tags": [
          "PartnerApi"
        ],
        "description": "Update membership roles for a subaccount. Optional roles: omit the field to leave roles unchanged. Only roles for products included in the request are changed. Optional firstName and/or lastName update the member name; omitted name parts keep the existing stored value.",
        "operationId": "updateSubaccountMembership",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "description": "ID of the parent organization",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "b443d63c-3e37-11f1-8898-0242ac000003"
            }
          },
          {
            "name": "subaccountId",
            "in": "path",
            "description": "ID of the subaccount",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "8ecb0a3c-3e38-11f1-96c0-0242ac000003"
            }
          },
          {
            "name": "membershipId",
            "in": "path",
            "description": "ID of the membership",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "2b609bb4-3e57-11f1-8a46-0242ac000003"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubaccountMembershipRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Membership was updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerApiMembership"
                }
              }
            }
          },
          "404": {
            "description": "Organization, subaccount, or membership could not be found"
          },
          "422": {
            "description": "Validation error, or last app admin cannot be removed without reassignment",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/general_validation_error"
                    },
                    {
                      "$ref": "#/components/schemas/partner_api_last_app_admin_removal_error"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "general_validation_error": {
        "properties": {
          "message": {
            "description": "Basic error description",
            "type": "string",
            "example": "The given data failed to pass validation."
          },
          "errors": {
            "description": "Basic error description",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "example": "cannot be blank"
              }
            }
          }
        },
        "type": "object"
      },
      "partner_api_last_app_admin_removal_error": {
        "description": "Returned when the last admin role for one or more apps cannot be removed without reassignment.",
        "required": [
          "message",
          "reasonCode",
          "needsAdminReassignForApps"
        ],
        "properties": {
          "message": {
            "type": "string",
            "example": "Can't remove admin role for these apps without assigning another admin."
          },
          "reasonCode": {
            "type": "string",
            "example": "error_removing_last_app_admin"
          },
          "needsAdminReassignForApps": {
            "description": "Product ids where another member must be promoted to admin first",
            "type": "array",
            "items": {
              "type": "string",
              "example": "formstack_classic"
            },
            "example": [
              "formstack_classic",
              "dobby"
            ]
          }
        },
        "type": "object"
      },
      "PartnerSubaccountMembershipRoleItem": {
        "oneOf": [
          {
            "description": "FSID/organization app: `role` is required and must not be null.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "organization",
                "enum": [
                  "organization"
                ]
              },
              "role": {
                "type": "string",
                "example": "admin",
                "enum": [
                  "admin",
                  "basic"
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Insure Sign app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "insure_sign",
                "enum": [
                  "insure_sign"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "admin",
                "enum": [
                  "admin",
                  "regular",
                  null
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Forms app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "formstack_classic",
                "enum": [
                  "formstack_classic"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "regular",
                "enum": [
                  "admin",
                  "regular",
                  "analyst",
                  "participant",
                  null
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Docs (Webmerge) app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "webmerge",
                "enum": [
                  "webmerge"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "user",
                "enum": [
                  "user",
                  "admin",
                  null
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Workflows (Dobby) app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "dobby",
                "enum": [
                  "dobby"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "regular",
                "enum": [
                  "regular",
                  "admin",
                  "workspace_user",
                  null
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Salesforce app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "salesforce",
                "enum": [
                  "salesforce"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "regular",
                "enum": [
                  "regular",
                  null
                ]
              }
            },
            "type": "object"
          },
          {
            "description": "Streamline (Thor/Odin) app: `role` must be present. Use `null` to skip granting on invite or remove access on update.",
            "required": [
              "product",
              "role"
            ],
            "properties": {
              "product": {
                "type": "string",
                "example": "odin",
                "enum": [
                  "odin"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "builder",
                "enum": [
                  "admin",
                  "manager",
                  "builder",
                  "operator",
                  null
                ]
              }
            },
            "type": "object"
          }
        ]
      },
      "UpdateSubaccountMembershipRequest": {
        "properties": {
          "firstName": {
            "type": [
              "string",
              "null"
            ],
            "example": "John"
          },
          "lastName": {
            "type": [
              "string",
              "null"
            ],
            "example": "Doe"
          },
          "roles": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PartnerSubaccountMembershipRoleItem"
            },
            "example": [
              {
                "product": "organization",
                "role": "admin"
              },
              {
                "product": "formstack_classic",
                "role": "regular"
              }
            ]
          }
        },
        "type": "object"
      },
      "PartnerApiInvitation": {
        "properties": {
          "type": {
            "type": "string",
            "readOnly": true,
            "example": "invitation",
            "enum": [
              "invitation"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "example": "1a509aa4-3e38-11f1-8c0d-0242ac000003"
          },
          "email": {
            "type": "string",
            "format": "email",
            "readOnly": true,
            "example": "pending@acme.com"
          },
          "firstName": {
            "type": "string",
            "readOnly": true,
            "example": "Pat"
          },
          "lastName": {
            "type": "string",
            "readOnly": true,
            "example": "Lee"
          }
        },
        "type": "object"
      },
      "PartnerApiMembership": {
        "properties": {
          "membershipId": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "example": "2b609bb4-3e57-11f1-8a46-0242ac000003"
          },
          "roles": {
            "type": "array",
            "items": {
              "properties": {
                "product": {
                  "type": "string",
                  "example": "dobby"
                },
                "role": {
                  "type": "string",
                  "example": "admin"
                }
              },
              "type": "object"
            },
            "readOnly": true,
            "example": [
              {
                "product": "organization",
                "role": "admin"
              }
            ]
          },
          "member": {
            "description": "Member (User or Invitation)",
            "readOnly": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerApiUser"
              },
              {
                "$ref": "#/components/schemas/PartnerApiInvitation"
              }
            ]
          }
        },
        "type": "object"
      },
      "PartnerApiUser": {
        "properties": {
          "type": {
            "type": "string",
            "readOnly": true,
            "example": "user",
            "enum": [
              "user"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "example": "b443d63c-3e37-11f1-8898-0242ac000003"
          },
          "email": {
            "type": "string",
            "format": "email",
            "readOnly": true,
            "example": "jane@example.com"
          },
          "firstName": {
            "type": "string",
            "readOnly": true,
            "example": "Jane"
          },
          "lastName": {
            "type": "string",
            "readOnly": true,
            "example": "Smith"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer authentication"
      }
    }
  },
  "tags": [
    {
      "name": "PartnerApi",
      "description": "PartnerApi"
    }
  ]
}
```