Only public communities can be joined by the user without an invitation. Community can be joined by the current API user after successful execution of the joinCommunity mutation. It accepts only one required argument - communityId.
  mutation joinCommunity {
    joinCommunity(communityId: 1) {
      errors
      response
    }
  }
If the mutation executed without any errors, a boolean value will be returned as a response, indicating the execution status.